我试图看看这是否有效:
SELECT TO_CHAR (TutorReport.Month, 'MONTH') MONTH, TutorReport.MatchID, MatchHistory.MatchID, MatchHistory.Tutor.ID
FROM TutorReport, MatchID
WHERE TutorReport.MatchID=MatchHistory.MatchID
AND NOT (TutorReport.Month=‘JULY’);
表:
TutorReport: MatchID,月,小时,课程
MatchHistory MatchID,TutorID,主题,学生ID,StartDate EndDate
感谢任何帮助
答案 0 :(得分:2)
您可以使用LEFT JOIN
,
SELECT a.*
FROM MatchHistory a
LEFT JOIN TutorReport b
ON a.MatchID = b.MatchID AND
TO_CHAR(b.Month, 'Month') = 'JULY'
WHERE b.MatchID IS NULL