I have a database table like this:
Room Name || Animal
----------------------------
Room1 || Cat
Room1 || Dog
Room1 || Dog
Room2 || Cat
Room2 || Cat
Room2 || Dog
Room2 || Dog
I want to read this table with a SQL query and as result I want to count the number of each animal in the room:
Room1: 1 cat 2 dog
Room2: 2 cats 2 dog
(The output format doesn’t matter)
Is there a SQL query that can help? Or should I read the whole table and filter it programatically?
Thank you for any help
This would return