I currently have a table which stores a load of statistics such as views, downloads, purchases etc. for a multiple number of items. To get a single operation count on each item I can use the following query:
SELECT *, COUNT(*)
FROM stats
WHERE operation = 'view'
GROUP BY item_id
This gives me all the items and a count of their views. I can then change 'view' to 'purchase' or 'download' for the other variables. However this means three separate calls to the database.
Is it possible to get all three in one go?