i have table in database select on:
select * tablea;
i want append column true or false if there's related column in anther table. can this:
select *, (select count(id) > 0 tableb id = tablea.id) tablea;
but don't want have count every row in tableb work out ineffient. want exists
check instead of count.
how replace count
exists
?
thanks!
by using left join
select a.*, b.id not null condition_check tablea left join tableb b on a.id = b.id
Comments
Post a Comment