getting multiple top rows

Results 1 to 2 of 2

Thread: getting multiple top rows

  1. #1
    Join Date
    Dec 1969

    Default getting multiple top rows

    my brain is turning to mush trying to figure this out.<BR><BR>I need to return a recordset of the most recent (unique to a user ID) rows from a table.<BR><BR>given (sample table):<BR>ID / date<BR>1 1/12/2000<BR>1 1/12/2001<BR>1 1/12/2002<BR>2 3/12/2002<BR>3 2/13/2001<BR>3 2/13/2002<BR><BR>I want to return<BR>1 1/12/2002<BR>2 3/12/2002<BR>3 2/13/2002<BR><BR>Do I have to create a fake aggregate and use groupby ??? I know I&#039;m missing something.<BR><BR><BR>thanks<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: getting multiple top rows

    select id,max(date) from t group by id

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts