我想根据1到20的数字从表中选择至少20条记录到新表中.
select * into blah from foo where fubar = '1'
如何在该声明中添加1到20?
编辑:
select * into blah from foo where fubar = '1' and where fubar = '2' and where fubar = '3'
抱歉.让我看看我能否说得更清楚.基本上我想基于fubar = 1到20选择20条记录.我试图使用"和where"但我得到语法错误.
eidt:如果fubar是nvarchar(11)
如果您的第一个表名是"foo"而新表名称是"blah"
SELECT * INTO blah FROM foo WHERE fubar BETWEEN 1 AND 20
要么
SELECT * INTO blah FROM foo WHERE fubar >= 1 AND fubar <=20
SELECT * INTO blah FROM foo WHERE fubar BETWEEN 1 AND 20