While wrong, here is an example.
SELECT i.aid as aid, count(i.id) as views, COALESCE(SUM(click),0) as clicks, COALESCE(SUM(con),0) as conversions FROM impressions as i LEFT JOIN ads_stats_clicks WHERE i.aid IN (3,4,21,40,41) GROUP BY i.aid
#1 - I need clicks/conversions sum for each aid
As it stands I am running two separate queries. One to request initial data and a second to request clicks/conversions.
I feel like it may be possible to efficiently combine this into one query.
This is a question better suited for stackoverflow.
If you message me the schema for the two tables I could give you the exact query that you want.