I have a simple EntityFramework application that accesses SQL Server 08 with a single table. I want to get a count of the rows like this:
Dim x = (From y in _Ctx.Table1).Count
Here's the SQL generated from this EF:
SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[Table1] AS [Extent1]
) AS [GroupBy1]
Question: Is there a way to have EF generate simpler SQL without the subquery, e.g.
SELECT COUNT(*)
FROM Table1
Thanks in advance, david