樓主使用的是子查詢,子查詢侷限性較大,只能顯示第一張表的欄位。你可以這樣寫
SELECT * FROM biz.coursecomment a,so.sodetail b,so.somaster c
where a.sono=b.sono and b.sono=c.sono and c.TeacherNO="100199" and b.IsStudentComment="1" AND IsTeacherComment="1" and a.ToCustomerNO="100199"
這樣寫就避免了各種的子查詢。當然,你還可以寫成join的形式。join的層次更分明,程式碼如下:
SELECT * FROM biz.coursecomment a
join so.sodetail b
on a.sono=b.sono
join so.somaster c
on c.sono=b.sono
where c.TeacherNO="100199" and b.IsStudentComment="1" AND IsTeacherComment="1" and a.ToCustomerNO="100199"
如果不懂,可以追問
樓主使用的是子查詢,子查詢侷限性較大,只能顯示第一張表的欄位。你可以這樣寫
SELECT * FROM biz.coursecomment a,so.sodetail b,so.somaster c
where a.sono=b.sono and b.sono=c.sono and c.TeacherNO="100199" and b.IsStudentComment="1" AND IsTeacherComment="1" and a.ToCustomerNO="100199"
這樣寫就避免了各種的子查詢。當然,你還可以寫成join的形式。join的層次更分明,程式碼如下:
SELECT * FROM biz.coursecomment a
join so.sodetail b
on a.sono=b.sono
join so.somaster c
on c.sono=b.sono
where c.TeacherNO="100199" and b.IsStudentComment="1" AND IsTeacherComment="1" and a.ToCustomerNO="100199"
如果不懂,可以追問