Tuesday, April 20, 2010

SQL Last() Function

0 comments
The function LAST returns the last value of items in a group. Without a GROUP BY clause it will return the last row of the SELECT. The value is nondeterministic if the values in a group are differently because there is no warranty of the row order.
Examples #1:
 Select Last(qty)
from sales_order
Examples #2 
Select  Last(qty)
from sales_order
group by order_id

0 comments: