Hello Listfolk,
I have a table with a 'category_fk' column and a 'status' column. 'Status'
has but a tiny handful of known values, kinda like an enum.
I'd like to form a query that would give me results like:
category_fk | status=1 | status=2 | status=3 |
------------------------------------------------
toys | 23 | 45 | 0 |
------------------------------------------------
games | 12 | 0 | 0 |
------------------------------------------------
books | 5 | 1 | 3 |
------------------------------------------------
Where the non-fk columns represent the counts of records with that
category_fk with a certain 'status'
I've got something close:
SELECT
category_fk,
count(*) as n,
status
FROM
myTable
GROUP BY
category_fk,
status
But this gives me a record for each category_fk/status.
TIA!
--
WF
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]