I have a hotels
table and I would like to know how many single/double/triple rooms I have.
Sample data:
room_id | user_id | user_name |
---|---|---|
1 | 1 | Bob |
2 | 11 | John |
2 | 22 | Jane |
3 | 111 | Jessi |
3 | 222 | Arthur |
3 | 333 | Dorra |
4 | 444 | Carl |
4 | 555 | James |
4 | 666 | Noel |
5 | 33 | Bill |
5 | 44 | Bell |
6 | 55 | Tina |
6 | 66 | Timor |
Examples:
room_id
1 has only a single occurrence. That's one "single" room.
room_id
2 appears twice so it's a "double" room. Same for room_id
5 and 6. So we have a total of 3 "double" rooms.
I need an SQL query to get the count of single/double/triple rooms. Like this:
single | double | tripple |
---|---|---|
1 | 3 | 2 |