我使用带有dict
子句的LEFT JOIN
进行查询,但是当我运行查询时,不匹配的数据不会显示在数据库中。我该如何解决这个问题?
WHERE
答案 0 :(得分:1)
我认为您想要on
子句中第二个表的条件:
SELECT g.id, a.NIK, a.tgl
FROM tbguru g LEFT JOIN
tbabsenpeg a
ON g.id = a.NIK AND
g.kodeapp = a.kodeapp AND
a.tgl = '2019-03-09'
WHERE g.kodeapp = 'Mantri-Lab 1020' ;
答案 1 :(得分:0)
您需要放置“ where”子句
tbguru.kodeapp ='Mantri-Lab 1020'
底部
SELECT tbguru.id, tbabsenpeg.NIK, tbabsenpeg.tgl
FROM `tbguru` LEFT JOIN tbabsenpeg
ON tbguru.id = tbabsenpeg.NIK
AND tbguru.kodeapp = tbabsenpeg.kodeapp
AND tbabsenpeg.tgl = '2019-03-09'
WHERE tbguru.kodeapp='Mantri-Lab 1020'