Dear,
I have got a working query that looks like :
TRANSFORM Nz(Count([Bezetting per dag].[KindgegevensId]),0) AS CountOfCustID
SELECT Kalender.Datum
FROM OpvangCodes INNER JOIN (Klantenbestand INNER JOIN (Kalender INNER JOIN [Bezetting per dag] ON Kalender.ID = [Bezetting per dag].KalenderId) ON Klantenbestand.Id = [Bezetting per dag].KindgegevensId) ON OpvangCodes.ID = [Bezetting per dag].OpvangCodesId
GROUP BY Kalender.Datum
PIVOT OpvangCodes.OpvangCode In ("VM","NM","D","X VM","X NM","X D","Z VM","Z NM","Z D","W VM","W NM","W D","A","NR","-");
This Crosstab query results in an overview per Date (row) where each column represents the TypeOfReservation and the Values are the number that the TYpeOfReservation occurs. The result looks like the screenshot below.
Question
The desired result is that the crosstab query (screenshot below) gets one extra column holding a '0' when the date corresponds with a holiday, and '1' when it does not correspond with a holiday.
Holidays are defined in a Holiday Table, with StartDatum and StopDatum per record.
I was thinking of a LEFT JOIN like this:
LEFT JOIN [Holiday] on (Kalender.Datum>=[Holiday].[StartDatum] AND Kalender.Datum<= [Holiday].[StopDatum]
But how to get it in the Crostab query syntax?