以下是我需要帮助的查询:
SELECT s.lastfirst, s.student_number, s.grade_level
FROM students s
WHERE s.schoolid = 300 AND s.enroll_status = 0 AND s.id not in
(
SELECT d.studentid
FROM section_meeting em INNER JOIN sections e
ON em.sectionid = e.id
INNER JOIN cc d ON e.id = d.sectionid
WHERE em.schoolid = 300 and em.period_number in (P1)
)
此查询工作正常,但我需要在结果中显示列em.period_number。谁能建议怎么做呢?
谢谢!
答案 0 :(得分:0)
查询工作正常,我需要显示列em.period_number 在结果中也是如此
如果您使用问题查询成功获得了结果,请让我添加period_number
加入查询...:
SELECT s.lastfirst, s.student_number, s.grade_level, section_meeting.period_number
FROM students s INNER JOIN
section_meeting ON s.schoolid = section_meeting.schoolid
WHERE (s.schoolid = 300) AND (s.enroll_status = 0) AND (s.id NOT IN
(SELECT d.studentid
FROM section_meeting em INNER JOIN
sections e ON em.sectionid = e.id INNER JOIN
cc d ON e.id = d.sectionid
WHERE (em.schoolid = 300) AND (em.period_number IN (P1))))