有两个表:
|idperson|工作负载|活动|idpm|名字|姓|
|idsupportday|日期|fk_person|
和这个 SQL 语句:
SELECT person.idperson, person.firstname, person.lastname, person.workload,
person.active, person.idpm, COUNT(supportday.idsupportday) AS SupportDays,
MIN(supportday.date) AS FirstDate, MAX(supportday.date) AS LastDate
FROM person
INNER JOIN supportday
ON person.idperson = supportday.fk_person
WHERE (person.active = 1)
GROUP BY person.idperson, person.firstname, person.lastname, person.workload,
person.active, person.idpm
现在如果supportday
表是空的,我也会收到一个空的结果。但我仍然希望所有人都person.active=1
在结果中。
我需要改变什么?
感谢您的回答。