I’m trying to understand how to rewrite a join query in LINQ.
SELECT cs.qid,cs.qk FROM location_table pl
JOIN (SELECT qid,qk FROM q_table WHERE att5 = 'process') cs ON pl.qck = cs.qk
WHERE pl.location = 'there'
Here is the LINQ I started with but it isn’t returning the same results as the above SQL
from pl in location_table
from cs in q_table
where s. att5 == 'process'
&& cs.qk == pl.qck
&& pl. location == 'there'
thanks for your help.
You need to use the
joinkeywordIf you want to rewrite this as an
EXISTSsince only output from q_table is needed:You would do this:
They should all end up with the same results. I will leave the performance check up to you 🙂