I have this query that getting the fields just from ad_media , but i can't figure out how to select also the fields that are in the subquery selection as well as the fields from the left join with ad_params any help thanks indeed
select ad_media.ad_media_id
, ad_media.ad_id
from ad_media
where ad_media.ad_id in
(
select action_states.ad_id
from action_states
where action_states.state = 'reg'
and action_states.action_id = '1'
and action_states.timestamp::date between '2018-04-17' and '2018-04-17'
and action_states.ad_id in
(
select ads.ad_id
from ads
where ads.category = '2010'
and ads.name = 'joe'
)
)
left join ad_params
on ad_media.ad_id = ad_params.ad_id;