subquery in LINQ
-
hi all, can any1 help me convert the following sub query in linq? select * from employee where employeeid in(select employeeid from dept where employeeid='E001'(I/P parameter)
T.Balaji
Without really trying this out, I would use
var q = from p in employee
where p.ID == (from d in dept select d.Employeeid)
select p;Deja View - the feeling that you've seen this post before.
-
Without really trying this out, I would use
var q = from p in employee
where p.ID == (from d in dept select d.Employeeid)
select p;Deja View - the feeling that you've seen this post before.
hi hanlon, var q = from p in employeewhere p.ID == (from d in dept select d.Employeeid)select p; == is 5n for a single row..but what abt if a query has multiple rows.Wont it return error "single row subquery returning more than 1 row"? Is there any equivalent keyword like "in"?i mean can we use like this? var q = from p in employeewhere p.ID in(from d in dept select d.Employeeid)select p;
T.Balaji
-
hi hanlon, var q = from p in employeewhere p.ID == (from d in dept select d.Employeeid)select p; == is 5n for a single row..but what abt if a query has multiple rows.Wont it return error "single row subquery returning more than 1 row"? Is there any equivalent keyword like "in"?i mean can we use like this? var q = from p in employeewhere p.ID in(from d in dept select d.Employeeid)select p;
T.Balaji
balaji.t wrote:
Wont it return error "single row subquery returning more than 1 row"? Is there any equivalent keyword like "in"?i mean can we use like this?
No - it won't. Try it and see.
Deja View - the feeling that you've seen this post before.