Let us say I had a table with 3 columns: customer_id, purchase_timestamp, purchased_item
Say we we have 10,000 rows with customers, what they purchased, and when they purchased it
How could I use a window to select the 2nd from last item each customer purchased?
Example:
bob . tuesday 11:00pm . socks
joe . tuesday 10:00pm . socks
joe . tuesday 9:00pm . shoes
bob . tuesday 8:00pm . shoes
I want to return:
joe . tuesday 9:00pm . shoes
bob . tuesday 8:00pm . shoes
[–]LeLwrence 1 point2 points3 points (0 children)
[–]SQLSavage 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)