I like this one better .. i think it's more maintainable.Originally posted by Highlander
Or you can try this, probably the same
SELECT *
FROM
(SELECT NAME,
SAL,
LAST_UPDATED_DATE,
MAX(LAST_UPDATED_DATE) OVER(PARTITION BY NAME, SAL) MAX_DATE
FROM
MY_TABLE)
WHERE MAX_DATE = LAST_UPDATE_DATE
Theoretically, it ought to be faster as well, sinceought to involve less work thanCode:MAX(LAST_UPDATED_DATE) OVER(PARTITION BY NAME, SAL)Code:row_number() over (partition by name order by last_update_date desc)




Reply With Quote