Home Forums SQL Server 2008 T-SQL (SS2K8) Error: Each GROUP BY expression must contain at least one column that is not an outer reference. RE: Error: Each GROUP BY expression must contain at least one column that is not an outer reference.

  • Chris,

    I tested your latest post and yes, it does indeed calculate all sums correctly using the same test data set. There was one minor typo I wanted to mention for others who might be following along: the expression "dx.LineItemTotal - mx.PaidToDate" needed changing to "dx.LineItemTotal - mx.PaymentPosted".

    Your original post introduced me to the 'Cross Apply' expression which I had never previously used. Rummaging around on the web I found the following article to be helpful in understanding it a bit further;

    http://sqlserverplanet.com/sql-2005/cross-apply-explained

    Again, thank you very much for the responses to my post - it is very much appreciated.