Andrew
Andrew

Reputation: 11338

Derived tables in Linq to SQL

I would like to implement this in Linq to SQL:

select * from (
    select * from Orders) as A

Obviously this is a pointless example, but I just can't figure out how to do it!

Upvotes: 1

Views: 1229

Answers (2)

jasonmw
jasonmw

Reputation: 1138

using (var dc = new NorthwindDataContext())
{
             var A = from ordOuter in
                 from ordInner in dc.Orders
                 select ordInner
             select ordOuter;
}

Upvotes: 0

Jeffrey Hantin
Jeffrey Hantin

Reputation: 36524

Try something like this:

var subquery = from row in Orders select row;
var query = from row in subquery select row;

Upvotes: 1

Related Questions