Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

USing MAX in SQL query

$
0
0

I have these values on my table:

FIPS  LoadDate    RecDate

1       10/1/2005    2/1/2005

1       12/3/2006      2/10/2005

1       3/10/2005      3/2/2005  <=====I want to pull this record

This is my query:

Select FIPS, LoadDate, max(RecDate)

from table1 group by FIPS, LoadDate

The problem with this query is all the load dates are displaying with the same RecDate. So all 3 records are displaying on the

results table. I only want the 3rd row pulled from the table. There are variable number of records for each unique FIPS.

There must be a simpler way to pull this data. Basically I just want to pull the max RecDate and the corresponding LoadDate.

Thank you for the help.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>