2015-01-16 40 views
-1

我有List myint = new List();如何在Ms sql服务器中选择多个记录

我想选择多个类似的productid = 1的productid = 2

如何选择使用MS SQL Server的多种产品

select * from product where ProductId = 1,2 

+0

您正在使用什么版本的SQL Server?它是什么类型的应用程序? '.net'? –

回答

0
select * from product where ProductId in(1,2) 
1

你可以写在此查询两种方式,

SELECT * FROM Products 
WHERE ProductID IN (1,2) 

SELECT * FROM Products 
WHERE ProductID = 1 
    OR ProductID = 2