-
last but one row
i was trying to get the last but one row for every order but unsuccessful.I tried the below.it works for one order_id perfectly but not for every order
SELECT *
FROM (
SELECT order_id, ordered_date,
RANK() OVER (ORDER BY ordered_date DESC) ORANK
FROM orders where order_id =56789)
WHERE orank = 2;
any help is much appreciated
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|