How would I write a Linq-to-SQL statement for the following TSQL?
select
count(*),
sum(Amount),
avg(Amount),
min(Amount),
max(Amount)
from
TableName
How would I write a Linq-to-SQL statement for the following TSQL?
select
count(*),
sum(Amount),
avg(Amount),
min(Amount),
max(Amount)
from
TableName
HACK ALERT, but it works. Try to group your records by a condition all of them share:
This generates the SQL:
There is a subquery involved, but hey! it's only one db trip
You could do:
It's probably easier to pull the values individually but you could do with an anonymous type.