I've been reading on lead and lag functions but I still don't get it. My sql syntax is as follows:
SELECT description, lag(description) over (ORDER BY transid ASC)
FROM transaction
WHERE transid = 20;
It's not returning the desired data. I have a table where transid is the primary key in int, and a column called description. I think the syntax is wrong because I want to return the whole row (all the column data) and I think this just returns one column of the previous row. How do I do that? Anybody?
Return an entire previous/next row.