クエリ 1:
SELECT count(id) as conversions, SUM(user_payout) as amount, geoip.country_name, geoip.country_code
FROM conversions
LEFT JOIN geoip ON conversions.end_ip BETWEEN geoip.start_long AND geoip.end_long
WHERE user_id = 1
AND type != ''
AND status = 1
AND month(created_at) = month(now())
GROUP BY country_name
ORDER BY country_name ASC
結果:
クエリ 2:
SELECT count(id) as clicks, geoip.country_name, geoip.country_code
FROM clicks
LEFT JOIN geoip on clicks.ip BETWEEN geoip.start_long AND geoip.end_long
WHERE user_id = 1
AND month(created_at) = month(now())
GROUP BY country_name
ORDER BY country_name ASC
結果:
この 2 つを組み合わせて、国ごとにクリック数、コンバージョン数、country_name、country_code を表示します。
これを行う方法がわかりません。
ありがとう!