I have a database with about 15000 rows, each row has an area code (from telephone numbers).
I want to
SELECT DISTINCT areacode, COUNT(*) FROM table WHERE DATE="$date1"
GROUP BY areacode ORDER BY count DESC
Which will show all distinct area codes, and their counts from highest count to lowest.
But, I need to find a way a combine that with:
SELECT DISTINCT areacode, COUNT(*) FROM table WHERE DATE="$date2"
GROUP BY areacode ORDER BY count DESC
The difference is the two different dates. For each area code, I want to divide the count from the first query by the count from the second query.
I cannot think of a way to do this without using very complicated and inefficient arrays.
There will be about 300 rows returned of DISTINCT area codes. Any ideas?