I have a table of receiving events by item and branch (skul) and I'm trying to pull only the most recent receipt date for each skul. I'm having trouble with an approach for the where clause.
Any help would be appreciated, here is SQL I am using now.
SELECT
branch||item "skul",
date,
order_num,
RANK () OVER (
PARTITION BY branch||item
ORDER BY date DESC
) "Rank"
FROM receipts