SELECT COUNT as a ROW??
Hi there, here is my dilema
I have a table of departments, with department codes, ie
department1 ONE
department2 TWO
I also have a table of PC's that are named with department codes, ie
ONE40567
ONE33345
TWO45443
I want to list all the departmens and next to them display how many PC's are in their department.
I have two queries:
1: SELECT * FROM department ORDER BY departmentname;
2: SELECT COUNT(DISTINCE computerrecno) AS 'computercount' FROM computers WHERE computername like 'TWO%'
So my first query lists the departments and the second returns a count of PC's where their name starts with TWO.
So; Can i merge these queries so my output looks like...
department1 402
department2 326
where the numbers are the pc's within a department?
Thanks for any help.
|