Serhan Eroğlu

Posts Tagged ‘lead

Lead() function

Posted by: eserhan on: February 24, 2009

If we had an orders table that contained the following data: ORDER_DATE PRODUCT_ID QTY 25/09/2007 1000 20 26/09/2007 2000 15 27/09/2007 1000 8 28/09/2007 2000 12 29/09/2007 2000 2 30/09/2007 1000 4 And we ran the following SQL statement: select product_id, order_date,  lead (order_date,1) over (ORDER BY order_date) AS next_order_date from orders; It would return the following [...]


Follow

Get every new post delivered to your Inbox.