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

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -