In my query each CLC_ID can have multiple CLC_Contact_SEQ as every new entry creates a new higher number for that member. I need to bring back the greatest entry for each ID number. Right now I just have them ordered so each ID I can see all of the entries. I am new to SQL and any help would be GREAT!
(comments are locked)
|
This is untested and off the top of my head, but if you just want to get the greatest
If you want to bring back the other columns, but only for the row that has the max contact sequence, then one approach is to do an inner join to the results of the above query. That would look something like:
That would certainly not be the only option, but it is one of the conceptually simpler ones. Essentially, it is filtering the results of the table by the rows that have the greatest contact sequence for that ID number.
(comments are locked)
|
Another approach would be to use the ROW_NUMBER function:
Definitely a great technique, though I think its a lot harder to understand that concept for someone new to sql.
Sep 04, 2012 at 04:32 PM
TimothyAWiseman
(comments are locked)
|
Thank you so much for all of the suggestions. Between them I was able to get my query to do what I needed. Thanks again for helping me!
(comments are locked)
|