读书人

求个sql2005 整合查询结果的方法高人

发布时间: 2012-02-10 21:27:41 作者: rapoo

求个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'

读书人网 >SQL Server

热点推荐