i have this query:
SELECT
SolutionName -- Solution_NAM
from Table_View
Group By 1
where Table_View is of course a view. I am gettign this error message:
Each GROUP BY expression must contain at least one column that is not an outer reference.
Can you help me resolve this? It´s inside Ms SQL Server 2008
In MySQL, when you try to select a column that isn't used in the GROUP BY clause, or in an aggregate function inside the statement, it is not a valid statement according to SQL standard and will cause an error.
An outer reference is a column name that does not refer to any of the columns in any of the tables in the FROM clause of the subquery. Instead, the column name refers to a column of a table specified in the FROM clause of the main query.
It means to group by the first column of your result set regardless of what it's called. You can do the same with ORDER BY .
GROUP BY without Aggregate Functions Although most of the times GROUP BY is used along with aggregate functions, it can still still used without aggregate functions — to find unique records.
you cannot give Group by 1
try
SELECT
SolutionName -- Solution_NAM
from Table_View
Group By SolutionName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With