Skip to main content
1 of 2
a1ex07
  • 9k
  • 3
  • 26
  • 40

The following gives you the most recent record per id

SELECT * FROM 
(
   SELECT a.* ,
   ROW_NUMBER() OVER (PARTITION BY ID ORDER BY date DESC) rn
)a
WHERE a.rn =1;

I'm not sure what you mean by complications when querying column of type DATE. 2010-01-01 is the same as midnight of Jan 1, 2010.

a1ex07
  • 9k
  • 3
  • 26
  • 40