Maybe I should make my query a bit more specific. The thing I get hung up on is the ability to both aggregate and specifiy criteria on the sub-select at run-time.
The SQL would look something like this:
SELECT
c.CustomerID
, c.CompanyName
, t1.TotalOrders
FROM
Customers c
INNER JOIN
(
Select
CustomerID
, Sum(UnitPrice * Quantity * (1 - Discount)) As TotalOrders
FROM
Orders o
INNER JOIN [Order Details] od
ON o.OrderID = od.OrderID
WHERE
o.OrderDate Between @OrderDate1 AND @OrderDate2 --'1997-01-01' AND '1997-3-31'
GROUP BY
o.CustomerID
HAVING
Sum(UnitPrice * Quantity * (1 - Discount)) > @OrderTotal1 -- 1000
) t1
ON c.CustomerID = t1.CustomerID
Given all the amazing things that the DQE can do already, it seems like there must be a way to do sub selects with aggregates. Maybe we need something like a TypedListWithParameters. Your answer to that might be that I should just use stored procedures for this situation and be done with it.
I'm working with SQL Server so I would describe what I'm looking for as similar to view that has been joined to a table-valued UDF.
Joel Reinford
Data Management Solutions LLC