我有两个表事件和enrolledevents当学生注册一个事件时,studentId和eventId存储在存储到enrolledevents表中 现在我希望得到所有未经学生注册的活动。
任何人都可以给我查询我尝试了很多查询但是我没有得到结果
[...Array(7)].forEach((_, i) => fillWebsitePlaceFiller(i + 1))
答案 0 :(得分:0)
将以下WHERE
条件移至JOIN ON
子句
AND (enrolledevents.estudent_id NOT IN ('1')
AND enrolledevents.eevent_id NOT IN ('3'))
像
SELECT
*
FROM
events
LEFT JOIN
enrolledevents ON events.event_id = enrolledevents.eevent_id
AND enrolledevents.estudent_id <> '1'
AND enrolledevents.eevent_id <> '3'
WHERE
events.event_occurance = 'daily'
AND events.status = '1';