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 JET Database Engine (0x80040E21) part of an aggregate function
- Article ID:
70 - Date Created
Tuesday, December 14, 2010 - This Article Has been Viewed
2313 times - Short Desc
When you build your QUERY with a COUNT you will have to add in all columns into a GROUP BY within your statement query. - Details
Builing a Query Statement for your ASP page within Access (or) SQL Server with a COUNT, you will have to add in all columns into a GROUP BY within the statement, if not you will get the following error.
Microsoft JET Database Engine (0x80040E21)
You tried to execute a query that does not include the specified expression 'username' as part of an aggregate function.
/header.asp, line 39 - Recreate Issue
To recreate this issue.
<%
sql.commandtext="select count(column1)as ctCol, col2, col3, col4 from table1"
%> - Resolve Issue
To use the GROUP BY within your Statement Query, do the following:
<%
sql.commandtext="select count(column1)as ctCol, col2, col3, col4 from table1 Group By col2, col3, col4"
%>
As you can see, we have added the Group By to our statement with the col2, col3, col4 added in so that we can use them in our page.
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