All pastes #164830 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-09 01:12 UTC
rendered paste body
<Xgc> Jy: SELECT ... FROM (SELECT ... [userid1 alias id, userid2 alias fid] UNION SELECT [userid2 alias id, userid1 alias fid]) as v1 and JOIN this with entries e ON e.userlink=v1.fid AND v1.id=2, then GROUP BY e.userlink ... SELECT e.userlink, MAX(timestamp) to get the information necessary to obtain the original record.  Join this with the base entry table to get the non-aggregate info.
<Xgc> Jy: Just the rough form needed.