User_info to correlate information from other social tables, but other social forms may not have this user
Select U.*, Coalesce (U.slogan, Tw.description, I.bio, g.bio,tu.description) as bio from User_info u
Left OUTER join Twitter_user tw on
u.user_name = Tw.screen_name left
OUTER join Instagram_user i on
u.user _name = I.username left
OUTER join Github_user g on
u.user_name = G.login left
OUTER join Tumblr_user Tu
on u.user_name = G.name
Raises another question: how PostgreSQL should judge an empty string
PostgreSQL coalesce in multiple table joins
But an empty string will still be chosen.
We're going to have to add a nullif judgment.
Select U.*, Coalesce (Nullif (U.slogan, '), Nullif (Tw.description, '), Nullif (I.bio, '), Nullif (G.bio, '), Nullif (Tu.description, ")" As bio from User_info u left
OUTER join Twitter_user tw on
u.user_name = Tw.screen_name left
OUTER join INS Tagram_user i on
u.user_name = I.username left
OUTER JOIN github_user g in
u.user_name = G.login
Left OUTER JOIN tumblr_user tu on
u.user_name = G.name
and changed to this.
Select U.*, COALESCE (Nullif (U.slogan, '), Nullif (Tw.description, '), Nullif (I.bio, '), Nullif (G.bio, '), Nullif ( Tu.description, ') as bio from User_info u left
OUTER JOIN twitter_user tw on
u.user_name = tw.screen_name
left OUTER Join Instagram_user i on
u.user_name = I.username left
OUTER join Github_user g on
u.user_name = G.login left
OUTER JOIN tumblr_user tu on
u.user_name = G.name