创建查询以将下面的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'
答案 0 :(得分: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
答案 1 :(得分: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'