Hello everyone,
I've written the following query which worked fine until I added the Group By clause.
SELECT DISTINCT Email,FormName,Timestamp,FirstName,LastName,Street,Town,City,County,Postcode,DayPhone,Newsletter,MoreInfo,Other FROM #TName#
WHERE FormName = '#CName#'
GROUP BY Email
ORDER BY FirstName
After adding the Group By clause, I'm being given the following error:
Microsoft][ODBC SQL Server Driver][SQL Server]Column 'table.FormName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Can anyone help? I've tried a million different ways of writing the query and I can't get it to work.
love ninja
I've written the following query which worked fine until I added the Group By clause.
SELECT DISTINCT Email,FormName,Timestamp,FirstName,LastName,Street,Town,City,County,Postcode,DayPhone,Newsletter,MoreInfo,Other FROM #TName#
WHERE FormName = '#CName#'
GROUP BY Email
ORDER BY FirstName
After adding the Group By clause, I'm being given the following error:
Microsoft][ODBC SQL Server Driver][SQL Server]Column 'table.FormName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Can anyone help? I've tried a million different ways of writing the query and I can't get it to work.
love ninja