score:1
for cross join just add another from
:
from fees in session.query<fee>()
//cross join:
from feetypes in session.query<session.query<fee>()
join ...
join ...
// left join:
join feetypelink in session.query<feetypelink>() on
new {fees.feeid,feetypes.feetypeid} equals new{feetypelink.feeid,feetypelink.feetypeid}
into gr
from res in gr.defaultifempty() .....
score:0
you can use this:
from a in ctx.as
join b in ctx.bs on a.id equals b.idofa //inner join for entities without relationships
join c in ctx.cs on 1 equals 1 //inner join with constant condition
score:1
just throw another from
in there, since you're not truly "joining" the tables, from a linq perspective.
from fees in session.query<fee>()
join feecategories in session.query<feecategory>() on fees.feecategory.id equals feecategories.id
join feecompanytype in session.query<feecompanytype>() on fees.id equals feecompanytype.fee.id
from feetype in session.query<feetype>()
select ...
score:1
the original query is nonsense and not really doing a cross join
in fact it is equivalent to this
select various a,b,c,d, and e columns
from fee a
inner join feecategory b on a.categoryid = b.feecategoryid
inner join feecompanytype c on a.feeid = c.feeid
left join feetypelink d on a.feeid = d.feeid
left join feetype e on e.feetypeid = d.feetypeid
now you should be able to convert it easily to linq to sql. i don't use that much so will leave others to fill in the details. you don't need anything fancy though.
Source: stackoverflow.com
Related Query
- Trying to convert cross join transact-sql into LINQ
- Convert SQL with multiple join into LINQ
- How to convert sql inner join query into linq to sql query and convert into list
- Convert simple Left Outer Join and group by SQL statement into Linq
- How do I convert this SQL inner join query into LINQ syntax?
- Convert sql code to linq (Inner join Query)
- Convert cross join SQL to LINQ
- how to convert a sql query into linq LEFT OUTER JOIN
- convert SQL query with multiple join on multiple tables using group by on multiple columns and with aggregate function into LINQ
- Trying to convert PIVOT SQL into LINQ lambda exp
- need to convert sql join query with count into linq and pass it to view
- Convert SQL to Linq left join with null
- Convert simple SQL group-by into LINQ to SQL
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- Unable to convert SQL Query to LINQ Query for Left Outer Join
- Convert SQL into Linq query
- How to get SQL query into LINQ form in C# code
- Can you convert this Linq statement into Lambda without using join statements?
- Does LINQ convert code to SQL queries
- How do i convert this linq code to inline sql
- Convert SQL IN clause with two columns into LINQ
- How to convert this complex SQL Query with Subqueries into LINQ
- convert linq to object query to sql query (no linq to sql code or datacontext)
- Convert piece of code into LINQ (short syntax)
- How to convert multiple SQL LEFT JOIN statement with where clause to LINQ
- How can I convert a SQL script into Linq
- Convert SQL query in LINQ query and move results into new datatable
- Convert Linq to Sql query into better sql
- Can I can convert this C# code into some Linq code?
- Translating Linq Code Block into SQL
More Query from same tag
- Implement a Discover page with friends of friends
- Faster version of LINQ .Any() and .Count()
- remove from List using Linq
- How to group and join to get counts?
- The query contains references to items defined on a different data context
- How to generate dynamic IQueryable extension method
- populating object collection property with Linq
- Read text file with dynamic conditional
- Accessing Results View from variable in code
- Separate data items into lists by DateTime
- linq case insensitive and trimmed comparison
- OleDb unhandled exception while querying List<T>
- How to show image in GridView form database linq
- Is there a LINQ-oriented method to quicky evaluate nested lists in dictionaries
- Dictionary as a Lookup value
- Retrieving related data using linq
- How to add array element check (IN SQL operation) in left outer join?
- Datalist paging with linq
- How to generate generic GetById(int Id) function in Linqtosql?
- testing record with join on 2 tables
- Linq to SQL - how to dynamically filter by columns not in select
- How do you remove xmlns from elements when generating XML with LINQ?
- Linq to entities parametrized constructor Datetime
- Selecting specific columns with Linq, using string or propertyInfo
- dispose bitmap in an array using linq
- SelectList in MVC incorrect syntax
- MVC Bulk Edit - Linq to Sql List Save
- How do I pass a Linq query to a method?
- How to Identify nested Group in Linq?
- C# & LINQ; Grouping files into 5MB Groups