Nested expressions

Q: Can I perform nested aggregate query expression such as:
       
select [Order ID], [Customer ID] from orders 
        left outer join 
        (
         select [Order ID],  sum(Quantity * [Unit Price]) as Total
         from [Order Details]
         group by [Order ID]
        ) as details on orders.[Order ID]=details.[Order ID]

A: No, unfortunately as per error value 25516 (SSCE_M_QP_NO_AGG_IN_AGG) in the SQL Server CE Books Online (which you can install locally via the msi located at C:\Program Files\Microsoft SQL Server Compact Edition\v3.1\SDK\Docs when you install the SDK) -  "Nested aggregate expressions are not allowed".

Published Friday, February 09, 2007 4:23 AM by Administrator

Comments

No Comments