我有两个表结构完全相同,一个是score,另一个是score1,我想把这两个表中的数据弄到一个表里!
score
student_no km_name test_type xq_name xl1 xl2...xl20 score_flag protect_f
20060026 数学 1 06-07 8 5 ..... 1 1
20060027 语文 1 06-07 9 6 ..... 1 1score1
student_no km_name test_type xq_name xl1 xl2...xl20 score_flag protect_f
20050036 英语 1 06-07 10 8 ..... 1 1
20050038 地理 1 06-07 11 6 ..... 1 1其中student_no ,km_name ,test_type ,xq_name这四个字段是联合主键,请各们大侠帮忙!谢谢!
score
student_no km_name test_type xq_name xl1 xl2...xl20 score_flag protect_f
20060026 数学 1 06-07 8 5 ..... 1 1
20060027 语文 1 06-07 9 6 ..... 1 1score1
student_no km_name test_type xq_name xl1 xl2...xl20 score_flag protect_f
20050036 英语 1 06-07 10 8 ..... 1 1
20050038 地理 1 06-07 11 6 ..... 1 1其中student_no ,km_name ,test_type ,xq_name这四个字段是联合主键,请各们大侠帮忙!谢谢!
解决方案 »
- 每页不能出现相同用户的产品
- 不同服务器上的数据库,表之间数据同步的问题或两个表联合查询
- 求复杂sql 语句
- sql 查询问题,多谢各位高手
- SQL2000的存储过程有安全可言吗?
- sql语句计算某一列值的平均分之和
- 数据库中一个字段存了两个部分的id,以逗号分割,在查询时候怎么能显示名称
- 【共享】【软件/SQL】SQL 智能提示工具(支持SqlServer,Oracle,access等所有主流数据库管理系统)
- 数据类型问题:一个数据库字段设定为FLOAT类型,输入数据为384.80,但用查询分析器查询的结果却变成了384.80000000000001,这是为什么?
- 为什么不能安装sqlserver2000
- 求更改一个库里所有表中字段“Manage_State”名字为 “Status”
- select查询语句效率很低,求助大家帮忙修改下。谢谢!
(
select * from score
union all
select * from score1
)t
select * from score1 as tmp
where not exists(select 1 from score
where student_no=tmp.student_no and km_name=tmp.km_name and test_type=tmp.test_type and xq_name=tmp.xq_name)
如果相同记录合并 就用union