1樓:匿名使用者
2.select c.stu_name 學生名字,d.
teacher_name 老師名字 from student c , (select a.class_no,b.teacher_name from classs a,teacher b where a.
teacher_no = b.teacher_no) d where c.class_no = d.
class_no
3.select a.class_name , b.
teacher_name ,teacher_major from classs a,teacher b where a.teacher_no = b.teacher_no and b.
teacher_major='計算機'
2樓:匿名使用者
select * from table1,table2 where table1.c=table2.c(c某相同字段)
或者用內鏈結或者外聯結:
selete * from table1 as t1inner join table2 as t2on t1.c=t2.c
外聯接selete * from table1 as t1left (right) join table2 as t2on t1.c=t2.c
sql查詢多表排序,sql多表分組查詢並排序的問題
select table2.from table2 inner join table1 on table2.table1 id table1.id order by table1.paixu 就像你寫的這樣,直接加過濾條件就可以 但是要在字段前加表名字首以區分兩個表的id欄位 select tabl...
sql語言多表查詢
查詢有不及格成績的學生姓名 select t stud.studname from t stud inner join t select on t stud.studno t select.studno where t select.score 60 查詢有選課的學生姓名 select studna...
sql連線查詢跟多表查詢的區別
這倆沒區別 就是寫法不同 這個就如同表1裡有a,b倆欄位一樣 select a,b from 表1 select from 表1 是一樣的 順便給你擴充套件下吧 在資料庫裡還有left join,right join,full join等 當這樣的時候用 select from table1,tab...