sql from PARTITION()
时间: 2023-08-11 14:05:45 浏览: 91
Sql in split
`PARTITION()` is not a valid SQL function. However, `PARTITION BY` is a clause used in SQL to divide a result set into partitions and perform calculations over each partition separately.
Here's an example usage of `PARTITION BY`:
```
SELECT customer_name, order_date, order_amount,
SUM(order_amount) OVER (PARTITION BY customer_name ORDER BY order_date) as running_total
FROM orders;
```
In this query, the `PARTITION BY` clause is used to group the result set by `customer_name`. The `SUM()` function is then used with the `OVER` clause to calculate a running total of the `order_amount` for each customer, ordered by `order_date`. The `running_total` column displays the running total for each row in the result set.
阅读全文