mysql display field values from subquery -
i have following query works correctly:
select * mytable a.company null , exists (select b.company mytable b b.id = a.id , b.office_id = a.office_id , b.company not null);
now, want display field value b.company subquery next fields mytable a.
how done?
thank , best regards
if want results multiple tables should join tables together. since want records exist in b, need use outer join returning records , matching in b. want exclude records not found in b.
select *, b.company mytable left join mytable b on b.id = a.id , b.office_id = a.office_id , b.company_id not null a.company null , b.id not null , b.office_id not null --this handles exists part.
Comments
Post a Comment