Skip to content
Advertisement

i cant view all data when i using Datepicker on ‘WHERE’

hy, please help me,, i cant view all data from emp0003 to checking all employee absence..

emp0003 table

NIK Name
01190301 Susan
01190302 Jamed

dvc0004 table’s

NIK Enroll
01190301 2021-02-03 08:06:27
01190302 2021-02-02 18:52:15
01190302 2021-02-02 08:02:32
01190302 2021-02-01 20:07:13
01190301 2021-02-01 20:07:13
01190302 2021-02-01 07:55:49
01190301 2021-02-01 07:55:49

this is my code :

and the result my code :

NIK Name Attendance
01190302 Jamed Attended

The result should be :

NIK Name Attendance
01190302 Susan Not Attended
01190302 Jamed Attended

please help me

Advertisement

Answer

You need to include the date condition on dvc0004 into the JOIN condition, otherwise it converts the join to an inner join, which is why you get no results for Susan. Also, you need to use either SELECT DISTINCT or a GROUP BY clause to remove duplicate rows (since in your sample data Jamed enrolled twice on 2021-02-02). I’ve gone with SELECT DISTINCT:

Output:

Demo on dbfiddle

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement