I'm trying to run a query with group by on NTEXT.
I saw the solution written on
Basic Query: Alternatives to 'Group By' for nText column to cast the ntext to varchar
and now I'm running the query:
" SELECT name, xmlFields, MAX(accountId)
FROM tblQueries
GROUP BY name, CAST(xmlFields as varchar(8000)) "
where xmlFields is my ntext fields
but I getting an error message:
Error 8120: Column 'xmlFields' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.