Thanks all for your help. I didn't really understand why it was sorting on
every field, but it now makes sense. What I ended up doing was replacing
the
SELECT DISTINCT * FROM JOIN ... WHERE ... ORDER BY... LIMIT ...
with
SELECT * FROM ... WHERE id in (SELECT DISTINCT id FROM JOIN ...
Hi all. I Have the following query (tested in postgres 8.4 and 9.0rc1)
SELECT distinct event0_.*
FROM event event0_ inner join account account1_ on
event0_.account_id_owner=account1_.account_id
LEFT OUTER JOIN friend friendcoll2_ ON
account1_.account_id=friendcoll2_.friend_account_id
WHERE (event