I have a table named IJ
with a datetime column IJDATE
, and varchar columns IJLOC
and IJITEM
. I need the most recent row for each combination of those two columns (and include the other columns, like IJLCGT
, an integer, for the most recent row). So for example, from this data:
IJLOC IJITEM IJDATE IJLCGT
Reno 12X12X12PX 2013-07-29 175705
Reno 12X12X12PX 2013-08-14 125905
I want this result (since it is the most recent row for that combination):
IJLOC IJITEM IJDATE IJLCGT
Reno 12X12X12PX 2013-08-14 125905
I've tried using MAX and grouping the varchar columns, but then I can't include the other columns.