score:0
what's wrong with
var result= query1.count() > query2.count();
return result; // result is of type bool
edit:
if you really want to execute it as one query on the server, you could use datacontext.executequery to execute a dynamic query.
score:4
try
return query1.count() > query2.count();
it's not worth trying to run two unrelated queries in the same server call, but here it is:
select case when (select count(*) from products)
> (select count(*) from orders)
then cast(1 as bit)
else cast(0 as bit)
however, i seriously doubt you can get linq to create this kind of query. you would have to call a stored procedure instead.
Source: stackoverflow.com
Related Query
- Combine two counting queries into one Boolean query
- combine two queries into one one query
- How can I combine this code into one or two LINQ queries?
- combine 2 queries from the same table into one linq query
- Can I make this two LINQ queries into one query only?
- A better way to combine two Linq Queries into one in MVC5 Controller
- Transforming two queries into one query in LINQ
- Combine two different types into one linq query and sort it
- how to combine two linq query into one in c#
- Refactor two linq queries into one single query
- How do I combine these two linq queries into a single query?
- Combine the results of two columns in a select into one array with LINQ?
- How do I combine multiple linq queries into one results set?
- How to Combine two Sum operations into one using LINQ?
- Combine two LINQ queries from different sources into single object
- Combine two lists into one based on property
- How to use LINQ to combine two or more collections into one collection
- Is there a way to combine two LINQ queries into one?
- C# Combine two lists with nested lists into one using LINQ
- Is there a way to combine these two LINQ statements into one
- how to combine two data source into one?
- Combining two LINQ queries into one
- Combine two LINQ queries returning bool to one returning bool?
- How can I code numerous MIN functions into one LINQ to DataSet query
- Combine Two Entities Into One Using LINQ
- Get two linq queries into one listbox
- How to Combine two object into one in C#
- How to combine two flat lists into one nested object
- How do I write a LINQ query to combine multiple rows into one row?
- How to combine / merge two StringCollection into one in C#
More Query from same tag
- Linq To SQL Query for counting same records
- How to call a function or property in a LINQ Query Provider (ExpressionVisitor)
- Lazy evaluation in async environment throwing exceptions using HashSet
- LINQ Cannot Implicitily Convert
- EF Code First selecting rows based on many to many relationship
- Left join using LINQ
- LINQ query in EF - many to many and a cross join
- Elegant solution to check if two dates are equal, in Linq (where the second date is NOT a parameter)
- How to add multi let operator and orderby in linq
- Which is the better approach for filtering?
- LINQ to SQL and a running total on ordered results
- Difference between DBNull.Value and IsValueNull()
- Replace the values of a few properties of a big POCO object?
- Rewrite foreach statement to linq
- EntityFunction.DiffDays Causes This function can only be invoked from LINQ to Entities
- LINQ Query over heterogeneous collection of different types with same base class
- How to use Query to add value in IQueryable?
- Emulating a join which uses a contains operator opposed to equals?
- How to remove objects that have 3 properties the same only leaving 1 but adding the number of those duplicates to a nr. column of that 1
- Correlated LINQ Query Optimization
- Join Two DataTables (Some Rows Match some Don't)
- Get list of titles from xml files
- Is there a way to transform a list of key/value pairs into a data transfer object
- sum distinct values from a column in datagridview
- C# lambda null conditional
- What is the best way to mix VB.NET's Option Strict and the new Option Infer directives?
- Convert SqlServer Query to LINQ
- Choose table to insert into using Linq
- Converting SQL Server query into linq
- How to modify table layout using linq?