I Have Table xDateList Contain:
+---------+
xDateList
+---------+
2018-11-01
2018-11-02
2018-11-03
2018-11-04
2018-11-05
And Also Table ScanLog
--------------------------------------
ID Name ScanDate Code
--------------------------------------
1 John 2018-11-02 07:00:00 IN
1 John 2018-11-02 10:00:00 OUT
1 John 2018-11-04 08:00:00 IN
1 John 2018-11-04 12:00:00 OUT
I have tried this but it cannot display all record on xDateList, it only show record on table ScanLog
select xDateList.date,
scanlog.name,
MIN(scanlog.scandate) AS `IN`,
MAX(scanlog.scandate) AS `OUT`
from scanlog
left JOIN xDateList ON xDateList.date = date(scanlog.scandate)
where scanlog.id='1'
GROUP BY DATE(scanlog.scandate)
I want result like this
--------------------------------------------
Date ID Name In Out
--------------------------------------------
2018-11-01 1 John
2018-11-02 1 John 07:00:00 10:00:00
2018-11-03 1 John
2018-11-04 1 John 08:00:00 12:00:00
2018-11-05 1 John
Thankyou for helping me