-2

我在创建查询以将SELECT以下查询组合成一个查询而不是手动运行每个查询时遇到了一点问题。这有助于我自己更轻松快捷地创建 CSV 文件

select top 200 * from dbo.abacus where  type =  'A'
select top 200 * from dbo.abacus where  type =  'B'
select top 200 * from dbo.abacus  where type =  'E'
select top 200 * from dbo.abacus  where type =  'F'
select top 200 * from dbo.abacus  where type =  'F'
select top 200 * from dbo.abacus  where type =  'FX'
select top 200 * from dbo.abacus  where type =  'E'
4

2 回答 2

1
select top 200 * from dbo.abacus where type = 'a'
union 
select top 200 * from dbo.abacus where type = 'b'

从这里阅读更多 http://msdn.microsoft.com/en-us/library/ms180026(v=sql.100).aspx

于 2012-12-03T16:40:35.637 回答
0

尝试UNION

select top 200 * from dbo.abacus where  type =  'A'
union
select top 200 * from dbo.abacus where  type =  'B'
union
select top 200 * from dbo.abacus  where type =  'E'
union
select top 200 * from dbo.abacus  where type =  'F'
union
select top 200 * from dbo.abacus  where type =  'F'
union
select top 200 * from dbo.abacus  where type =  'FX'
union
select top 200 * from dbo.abacus  where type =  'E'
于 2012-12-03T16:38:14.967 回答