如何在sqlserver中使用union查询联合数据

时间:2026-02-15 14:30:57

1、打开sqlserver管理器,菜单栏上的“新建查询”按钮

如何在sqlserver中使用union查询联合数据

2、在查询框中输入:

select kechenghao,kechengming from 课程表

 union 

select xuehao,xingming  from 学生表

如何在sqlserver中使用union查询联合数据

3、两个表中的列数需要一致,点击菜单上的“执行”按钮

如何在sqlserver中使用union查询联合数据

© 2026 长短途
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com