I have a table which stores search phrases and IP addresses. I want to execute a query that will give me each search phrase along with the number of unique IPs associated with that phrase. How can I accomplish this "nested" group by?
SELECT search_phrase, COUNT(*) as c FROM search_tracking GROUP BY search_phrase ORDER BY c DESC
The above obviously groups the search_phrases but does not account for a single user searching for that phrase over and over. Any help?