Sk Asraf Sk Asraf - 1 year ago 80
SQL Question

What is the exact LINQ Query for this SQL Query?

I can't understand what the exact

query is of this SQLquery.

Please give exact
Query similar to this SQL query.

Select * From tblProduct
Where ProductId In
(Select ProductId from tblViewer Where ViewerId = 123)

Answer Source

Contains is the most straightforwrad way to implement an IN statement, so it would be something like:

tblProduct.Where(p => tblViewer.Where(v => v.ViewerId == 123)
                               .Select(v => v.ProductId)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download