[thelist] SQL Max Query Distinct

rudy r937 at interlog.com
Thu Nov 14 13:13:01 CST 2002


and if you want the other columns from the row which has the latest date,

select id, foo, bar, thedate
  from yourtable XX
inner
  join ( select id
              , max(thedate) as maxdate
           from yourtable
       group by id ) YY
    on XX.id= YY.id
   and XX.thedate = YY.maxdate


rudy




More information about the thelist mailing list