Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

You tried to execute a query that does not include the specified expression as part of an aggregate

Status
Not open for further replies.

irethedo

Technical User
Feb 8, 2005
429
US
I am getting the following message when I run this query:
You tried to execute a query that does not include the specified expression 'Date' as part of an aggregate function

Code:
SELECT A.Date, A.Cust_Name, A.SO_No, (select count(*) from SPnoteOrder_tbl as B where B.LineNO < A.LineNO and A.ComputerName = b.computerName)+1 AS Rank, A.ComputerName, A.FriendlyName, A.License_PartNo, A.Part_No, A.System, A.NW_Ver, A.Country INTO Order_tbl
FROM SPnoteOrder_tbl AS A
GROUP BY A.NW_Ver;

What am I missing?

thanks
 
Just a guess here, but Date is a reserved word in Access (that should be avoided).
Try
[tt]SELECT A.[Date], A.Cust_Name, ...[/tt]
or rename your field Date to something else.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
I renamed it to Date1 both in the query and the table and still get the same
error with the new name of the field...

You tried to execute a query that does not include the specified expression 'Date1' as part of an aggregate function
 
Usually you use GROUP BY if you do aggregate query, but in your example you do not do that. The only aggregate is in the inner SELECT which you don't need to do Group by.
Try to eliminate the GROUP BY part and see if you get what you want.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top