i have table like :
table : a
a_id, b_id, c_id, type, created_at
i should join a with table b or c
for each row, just one of the b_id or c_id is filled(according to type)
if b => a should join with b
c => a should join with c
how can i do this in postgresql
How can i do this in postgresql
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rajanikant HawaldarRank #110 · 20.2K reputationPosted Jun 14, 2021, 1:28 AM EDT
Two left joins with "AND a = ..." in the join condition.
Adarsh142 reputationPosted Jun 14, 2021, 1:32 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Jun 14, 2021, 1:34 AM EDT
Adarsh142 reputationPosted Jun 14, 2021, 1:38 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Jun 14, 2021, 1:44 AM EDT