SQL error when using Group By: Each GROUP BY expression must contain at least one column that is not an outer reference.
SQL error when using Group By: Each GROUP BY expression must contain at least one column that is not an outer reference