Dear,
I have 3 tables:
Calendar Customer Type of reservation Id Date Id Name Id Reservation Type 1 1/01/2018 1 Matthew 1 AM 2 2/01/2018 2 Jake 2 PM 3 3/01/2018 3 Els 3 D … … … … … Table 1: Table holding a calendar
Table 2: Table holding Customers info
Table 3 : Table holding information of the type of reservation
Now, I got a query that populates a table that show per date which customer has which type of reservation, resulting in table:
Reservation Id CalendarId CustomerId Type of Reservation Id 1 1 1 1 2 1 2 1 3 1 3 3 4 2 1 1 5 2 2 2 6 2 3 1 7 3 1 3 8 3 2 2 10 3 3 1 11 … … …
Question
How to make the query that lists the dates (group by) and then shows a column per type of reservation and count the number of times that type of reservation occurred for that date. For the example above, result should be:
Query Id Date # AM # PM # D 1 1/01/2018 2 0 1 2 2/01/2018 2 1 0 3 3/01/2018 1 1 1
Thank you in advance.