I’m trying to generate a report base on pre defined dates(cutoff dates). I have two tables, the in and out and overtime table.
IN and OUT table

Overtime Table

Expected Result

Using UNION, it doubles the dates, but that can be solve supposedly by group by, but group seems not to work in UNION.
And the tricky part is to show the BLANK 6-Jan and 5-Jan. I need to show this coz its a timesheet report.
Any help or clue will be greatly appreciated
CODE:
SELECT emp_id,in,out,null
FROM normal
WHERE date >= '1-Jan'
AND date <= '10-Jan'
AND emp_id = '10001'
UNION
SELECT emp_id,null,null,minutes
FROM overtime
WHERE date >= '1-Jan'
AND date <= '10-Jan'
AND emp_id = '10001'
Something like this should do what you want(if i weel understood the question) :
Keep in mind that if you want to show even the dates with no matches, you have to create a table with the list of this dates :
dates
Then you can change the query in this way to get the result set you want :
If you want to avoid the dates table you can try with this more complex query, should give you the same result, without the needs of a third table that store the range of dates :