THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
There can be multiple OVER
clauses in a single query. A single OVER
clause only applies to the immediately preceding function call. In this example, the first OVER clause applies to COUNT(b) and the second OVER clause applies to SUM(b):
Code Block | ||
---|---|---|
| ||
SELECTSELECT a, COUNT(b) OVER (PARTITION BY c), SUM(b) OVER (PARTITION BY c) FROM T; |
Aliases can be used as well, with or without the keyword AS:
Code Block | ||
---|---|---|
| ||
SELECTSELECT a, COUNT(b) OVER (PARTITION BY c) AS b_count, SUM(b) OVER (PARTITION BY c) b_sum FROM T; |
...