I have a database (MySQL 5.5) similar to this:
ID Name Page Visited Date
1 Tim Page A 11-2-2000
1 Tim Page B 11-3-2000
1 Tim Page B 11-3-2000
2 Jeff Page C 11-5-2000
2 Jeff Page A 11-11-2000
I want to build a query (trying to at the moment), where the results would be similar to this:
ID Name Page A Visits Page B Visits Page C Visits
1 Tim 1 2 0
I assume that I need to run the following query against a subset (my question is how do I do this with essentially 3 counts)?:
SELECT * From database.mytable GROUP BY ID HAVING COUNT(*) >=1
if you have unknown number of
page, you can alsoPreparedStatement