I want to select and count all cats and dogs at one location;
location | cats | dogs |
new york | 150 | 66 |
paris | 34 | 12 |
What I've got so far:
SELECT
cats,dogs
FROM
(select k.location, count(*) as cats from pet k, location lo where k.location= lo.id and k.pet= 'Cat' group by k.location)
union
(select k.location, count(*) as dogs from pet k, location lo where k.location= lo.id and k.pet= 'Dog' group by k.location)
But I only get one column for location and cats...