My first query:
SELECT pCountry, COUNT(pCountry) as tempCount
FROM mStatistics
GROUP BY pCountry
ORDER BY tempCount DESC
LIMIT 0,7
Second query:
SELECT DISTINCT(pAddr), pCountry, COUNT(pCountry) as tempCount
FROM mStatistics
GROUP BY pCountry
ORDER BY tempCount DESC
LIMIT 0,7
The two produce the exact same result.
The first query sums up the nationality of all hits on a page.
The goal with the second one was to only sum up nationality on unique hits on the page.
I thought by selecting pAddr (IP address) as distinct it would only select distinct ips, their countries and group the result of that by country, instead, it selects all rows just like the first query?