Hello all, I have a table with columns 'customer' and 'location' and I need to check top 10 locations visited by unique customers.
I'm ready to do the following:
- SELECT location FROM myTable GROUP BY location
- load results to an array (maybe a hundred of few hundreds of locations)
- SELECT COUNT(*) AS total, tbl.location AS LOCATION FROM (SELECT DISTINCT customer FROM myTable WHERE location = location_inserted_by_php) as tbl;
Now, this sounds like a rather stupid solution, but I'm rather unacquainted with nested queries. Any help?
Thanks