Adjust documentation wording of window function ORDER BY to not mention

avg() because it was inaccurate.
This commit is contained in:
Bruce Momjian 2011-02-20 00:01:08 -05:00
parent 8c0f1e2762
commit d5813488a4

View File

@ -383,10 +383,10 @@ SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM emps
</para> </para>
<para> <para>
Although <function>avg</> will produce the same result no matter You can also control the order in which rows are processed by
what order it processes the partition's rows in, this is not true of all window functions using <literal>ORDER BY</> within <literal>OVER</>.
window functions. When needed, you can control that order using (The window <literal>ORDER BY</> does not even have to match the
<literal>ORDER BY</> within <literal>OVER</>. Here is an example: order in which the rows are output.) Here is an example:
<programlisting> <programlisting>
SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary DESC) FROM empsalary; SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary DESC) FROM empsalary;