I'm trying to create a query with multiple counts on a subset of a table.
I've found:
SELECT (SELECT COUNT(*)FROM Table WHERE Item = 1) AS Field1,
(SELECT COUNT(*)FROM Table WHERE Item = 2) AS Field2
which does return the total count of Items = 1 and Items = 2 in Table. My problem is that I'd like to perform these counts on a subset of the table, for example 'WHERE Client = 1' and I'd also like to return the client number.
Anyone with any ideas?
Thanks,
Biff
I've found:
SELECT (SELECT COUNT(*)FROM Table WHERE Item = 1) AS Field1,
(SELECT COUNT(*)FROM Table WHERE Item = 2) AS Field2
which does return the total count of Items = 1 and Items = 2 in Table. My problem is that I'd like to perform these counts on a subset of the table, for example 'WHERE Client = 1' and I'd also like to return the client number.
Anyone with any ideas?
Thanks,
Biff