Subject | Re: [Firebird-Architect] Improving CTE with ANSI SQL2003 Window Functions |
---|---|
Author | Adriano dos Santos Fernandes |
Post date | 2008-04-08T16:05:01Z |
Philippe Makowski escreveu:
window definition" in the standard.
What I don't understand and never see is the named "window definition",
that starts with the word WINDOW.
--
Adriano dos Santos Fernandes
http://www.firebirdsql.org
> Adriano dos Santos Fernandes [08-04-08 18.58] :This is the syntax I know and use in Oracle. :-) It's named "inline
>
>> Do you have a sample query using WINDOW clause?
>>
>> I suppose it's like CTE WITH, but I never see one...
>>
>> I know only the syntax:
>> select n, count(*) over ()
>> from table
>>
>>
> yes that's it
>
> for example :
>
> Calculating Median Value per Employee by Using a CTE and ROW_NUMBER
>
> WITH OrdersRN AS
> (
> SELECT EmployeeID, Value,
> ROW_NUMBER() OVER(PARTITION BY EmployeeID ORDER BY Value) AS RowNum,
> COUNT(*) OVER(PARTITION BY EmployeeID) AS Cnt
> FROM VOrders
> )
> SELECT EmployeeID, AVG(Value) AS Median
> FROM OrdersRN
> WHERE RowNum IN((Cnt + 1) / 2, (Cnt + 2) / 2)
> GROUP BY EmployeeID;
window definition" in the standard.
What I don't understand and never see is the named "window definition",
that starts with the word WINDOW.
--
Adriano dos Santos Fernandes
http://www.firebirdsql.org