tags:

views:

250

answers:

1

What is valid Linq Statement for

from a in Active_SLA 
where a.APP_ID == (from f in FORM_PAGES where f.PAGE_ADDRESS == @Address select f.APP_ID)
 && a.PERSON_ID == (from p in PERSON_DEVICES where p.DEVICE_NUMBER == @number select p.PERSON_ID) 
select a.PRIORITY
+1  A: 

Rather than nested queries, you should use join statements to combine tables based on matching columns.

In your example, the proper Linq query would look something like this:

from a in Active_SLA
join f in FORM_PAGES on a.APP_ID equals f.APP_ID
join p in PERSON_DEVICES on a.PERSON_ID equals p.PERSON_ID
where (f.PAGE_ADDRESS == @Address) && (p.DEVICE_NUMBER == @number)
select a.PRIORITY;

Hope that helps!

ph0enix