当前位置: 代码迷 >> Sql Server >> 求个sql2005 整合查询结果的方法,高人进~ 多谢
  详细解决方案

求个sql2005 整合查询结果的方法,高人进~ 多谢

热度:90   发布时间:2016-04-27 15:00:59.0
求个sql2005 整合查询结果的方法,高人进~ 谢谢
表 goods
id name
1 哈哈
2 呵呵

select * from goods where id = '1'
select * from goods where id = '2'

2个查询方法执行后是2个结果,如果能把这2个结果整合到一起返回结果呢?
请指点谢谢拉~

------解决方案--------------------
SQL code
--1select * from goods where id = '1' or id = '2'--2select * from goods where id = '1'union all select * from goods where id = '2'
------解决方案--------------------
探讨

SQL code

--1
select * from goods where id = '1' or id = '2'
--2
select * from goods where id = '1'
union all
select * from goods where id = '2'
  相关解决方案