SELECT COALESCE(ts1.user_id, ts2,user_id, ts3.user_id) AS user_id,
That should probably be ts2 DOT user_id. Cheers, Andomar -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general