CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
Microsoft OLE DB Provider for SQL Server (0x80040E14) Column ' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
- Article ID:
78 - Date Created
Friday, December 24, 2010 - This Article Has been Viewed
1934 times - Short Desc
When you build a SQL Statement with a Count and have other Columns that are used in the Statement, you must include then in a GROUP BY clause. - Details
When you build a SQL Statement with a Count and have other Columns that are used in the Statement, you must include then in a GROUP BY clause. If you do not include the other Columns, you will receive the following error.
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Column 'pics.PicsName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
/Results.asp, line 71 - Recreate Issue
To recreate this error.
<%
getPics.commandtext="SELECT COUNT(thID) AS count, Name, Path, Pic from pics where id=?"
%> - Resolve Issue
To correctly write this Statement.
<%
getPics.commandtext="SELECT COUNT(thID) AS count, Name, Path, Pic from pics GROUP BY Name, Path, Pic HAVING id=?"
%>
As you can see in the example above, we have added all the Columns that are used in our GROUP BY clause.
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16825