合併查詢

joytoy發表於2021-09-09

select couname,couno
from Course
union all
select state,couno
from StuCou
order by couno

select couname,couno into coursestate
from Course
union
select state,couno
from StuCou
order by couno

select*from coursestate

drop table coursestate
--查詢學生表的學生姓名,班級表的班級名稱,將結果合併到coursestate中
select stuname,classno into classstudent
from Student
union
select classname,classno
from Class
order by classno

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4650/viewspace-2801242/,如需轉載,請註明出處,否則將追究法律責任。

相關文章