Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to write below query in Linq?

SQL
select c.Name,Location from Category c
join somechildtable ct
on c.ID = ct.CategoryID
cross join Locations


Thanks.
Posted

1 solution

While your original query seems to miss a table prefix for the Location field in the select list, I have assumed it comes from the Locations table.
Your LINQ query would be:

C#
from c in Category
from l in Locations
join ct in somechildtable on c.ID equals ct.CategoryID
select c.Name, l.Location
 
Share this answer
 
Comments
NAPorwal(8015059) 10-Sep-14 16:33pm    
Yes I missed a Location table prefix. Thanks for your help :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900