> SELECT COALESCE(ts1.user_id, ts2,user_id, ts3.user_id) AS user_id,
That should probably be ts2 DOT user_id.
Cheers,Andomar