All pastes #978781 Raw Edit

Stuff

public sql v1 · immutable
·published 2008-04-09 20:25 UTC
rendered paste body
# get the row for each user based on each userid's max individual expiresSELECT    userid,    expires,    make,    modelFROM    tbl1 t1JOIN (    SELECT        userid,        MAX(expires) AS max_exp    FROM        tbl1        GROUP BY        userid) t2 ON (    t2.userid = t1.userid AND    t2.max_exp = t1.expires)