I have one query for MySQL, and need to left join twice. There are four tables A, B, C, D, and two possibilities, if A.label is null then,
select ... from A
left join B on B.name=A.name
left join D on B.bid=D.id;
otherwise, if A.label is not null, I have
select ... from A
left join C on C.name=A.name
left join D on C.cid=D.id;
If I want to merge these two queries into one via CASE condition, what should I do?