简体   繁体   中英

How do tsql query in linq

in sql i have query

select * from table where id in (5,7,8)

How do this in LINQ query?

var t = from u in table
               where new[] { 5, 7, 8 }.Contains(u.id)
               select u
var ids = new int[] { 5, 7, 8 };
var rows = from row in table 
           where ids.Contains(row.id) 
           select row

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM