Closed jimfoye closed 5 years ago
We could add support for sub-queries in select, but the problem is that ExpenseReports.ExpenseReportID
is a parameter for the sub-query (nested LINQ lambda) but not a parameter to the main query, so how to identify that.
As a workaround I would go for SQL view and query the view with SQLProvider.
OK, thanks.
How do I do a subquery using count? All the examples I've seen only use count in its own query.
For example, if I want expense reports and the count of items for each report, I can do it in a single SQL statement like this:
I can get this to compile:
But I get an exception:
System.ArgumentException: Method 'FSharp.Data.Sql.Common.SqlEntity GetSubTable(System.String, System.String)' declared on type 'FSharp.Data.Sql.Common.SqlEntity' cannot be called with instance of type 'Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject`5[FSharp.Data.Sql.Common.SqlEntity,FSharp.Data.Sql.Common.SqlEntity,FSharp.Data.Sql.Common.SqlEntity,FSharp.Data.Sql.Common.SqlEntity,System.Int32]'