Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have generated a calendar in a DB... All dates with weekend and holiday flags.
I try to figure out the proper way to join my Calendar date with the date from the clocking system. The clocking table has only working dates, so when I join it together, I lost the weekend and holiday dates.
I need to table all dates for each ID from the clocking table with data or nulls and then do some scripts/calculations on top of that like attendance (was or was not at work), etc.
Have you please idea how to do it in a proper and fast way?
Thanks
Hi @jarokall Can you try the below and let me know how it goes?
[Calendar]:
LOAD
`calendar_date`,
date_stamp,
`calendar_day`,
`calendar_work`,
`calendar_holiday`,
`calendar_name`;
SQL SELECT
`calendar_date`,
`calendar_date` as date_stamp,
`calendar_day`,
`calendar_work`,
`calendar_holiday`,
`calendar_name`
FROM calendar.calendar as calendar;
ClockingData:
LOAD
date_stamp,
user_id,
total_time as working_shift
RESIDENT Calendar;
LEFT JOIN(Calendar)
LOAD
date_stamp,
user_id,
total_time as working_shift
FROM clocking.recurring_schedule;
Note: Make sure the field names, such as calendar_date
, date_stamp
, user_id
, and total_time
, match the field names in your actual data schema.
Hi, @Vinay_B
thanks for the response. I tried your solution but I get this error.