请帮助我了解错误是什么

时间:2019-07-18 18:17:45

标签: sql

我不明白为什么我的查询无法正常工作,请帮助

select *
from 
(
    select Semester, StudentID, CourseCode, MarksObtained,CourseWeekName
from dstp_dm.lms.vStudentQuizResult
where CourseWeekName<='Week 04'

) aa
Full Outer join 
(
  select Semester,StudentID,CourseCode,Score,CourseWeekName
  from lms.vStudentAssignment
  where CourseWeekName<='Week 04'

)

3 个答案:

答案 0 :(得分:0)

可能是因为where CourseWeekName<='Week 04'。如我所见,CourseWeekName是字符串,而不是数字,因此您不能使用像<=

这样的比较运算符

答案 1 :(得分:0)

第二个表中缺少别名

select aa.*,bb.*
from 
(
    select Semester, StudentID, CourseCode, MarksObtained,CourseWeekName
from dstp_dm.lms.vStudentQuizResult
where CourseWeekName<='Week 04'

) aa
Full Outer join 
(
  select Semester,StudentID,CourseCode,Score,CourseWeekName
  from lms.vStudentAssignment
  where CourseWeekName<='Week 04'

)bb on aa.StudentID=bb.StudentID

答案 2 :(得分:0)

FULL OUTER JOIN仍然需要一个JOIN条件(on col1 = col2) 什么不起作用?查询是引发错误还是给出错误的结果? 如果查询运行但给出错误结果,则分别运行。