Requirement : I need list of items purchased in a month. If a item purchased more than once in a month then i need the recent purchase order number.
Solution :
SELECT * FROM (SELECT segment1, description, ponumber, ROW_NUMBER () OVER (PARTITION BY segment1 ORDER BY pocreationdate DESC) mycol FROM base_table WHERE TO_CHAR (pocreationdate, 'MM YYYY') = '04 2008') WHERE mycol = 1
No comments:
Post a Comment