I have data similar to what is below. I have duplicates across the 4 grouping criteria that I’ve indicated. I need the one record that is the max value of both the date submitted and time submitted (unfortunately, both varchar data) across the grouping values. So, in the data set I've provided, there are 2 groups of 3 (these are transactions.. bill, reverse, bill) and I need the last one to have happened. I've been boning this up all day and was hoping one of you guys could help bail me out.
----------------------------------------
TWljcm8kb2Z0J3MgIzEgRmFuIQ==
Code:
PK Transaction Status DateSubmitted TimeSubmitted Amount Grouping Criteria 1 Grouping Criteria 2 Grouping Criteria 3 Grouping Criteria 4
18 P 20070405 183907 195.46 20070405 12345678 180000 XJ37SMTR
19 X 20070405 190346 -195.46 20070405 12345678 180000 XJ37SMTR
22 P 20070406 113724 195.46 20070405 12345678 180000 XJ37SMTR
61 P 20070401 161821 18.88 20070401 87654321 60000 WSYD342
62 X 20070401 163754 -18.88 20070401 87654321 60000 WSYD342
63 P 20070401 163803 18.88 20070401 87654321 60000 WSYD342
My results should be
22 P 20070406 113724 195.46 20070405 12345678 180000 XJ37SMTR
63 P 20070401 163803 18.88 20070401 87654321 60000 WSYD342
----------------------------------------
TWljcm8kb2Z0J3MgIzEgRmFuIQ==