I have two mySQL queries that work without any problems. The first one fetches referers, and the second one calculates the country %'s and numbers. However, I need to include the country %'s and numbers in the first query, in other words, how can I use them together ?
SELECT *, COUNT(*) FROM track
where referid='".$member."'
GROUP BY referer
ORDER BY id desc limit 0,15
select id, country, num, num*100/total pct
from (SELECT id,country, count(*) as num
FROM track GROUP BY country
ORDER BY num desc limit 3) x
join (select count(*) total from track) y