Linq-to-sql join/where?
- by Curtis White
I've the following table structures
Users
id
Types
id
isBool
UsersTypes
userid
types
I want to select all the UserTypes based on id and isBool.
I tried this query
var q = from usertype in usertypes
from type in types
where type.isBool == false
where userstypes.user == id
select usertype;
But this did not work as expected. My questions are:
Why?
Is there any difference in using the join on syntax vs where, where vs where cond1 && cond2? My understanding is query optimizer will optimize.
Is there any difference in using where cond1 == var1 && cond2 == var2 with and without the parenthesis? This seems peculiar that it is possible to build this without parenthesis
What type of query do I need in this case? I can see that I could do a subquery or use a group but not 100% sure if it is required. An example might be helpful. I'm thinking a subquery may be required in this case.