On 31 October 2016 at 15:21, Geoff Winkless <pgsqladmin@xxxxxxxx> wrote: > LEFT JOIN words_social s1 ON s1.uid = in_uid > LEFT JOIN words_social s2 ON CASE WHEN g.player1 = in_uid THEN > g.player2 ELSE g.player1 Ugh. Of course I meant LEFT JOIN words_social s1 ON s1.uid = in_uid LEFT JOIN words_social s2 ON s2.uid = CASE WHEN g.player1 = in_uid THEN g.player2 ELSE g.player1 END But I expect you know that... Geoff -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general