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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot group on fields selected with '*'

Status
Not open for further replies.

rccline

Technical User
Jun 13, 2002
341
US
I am trying to run a query with group and count. If I select group for my query, or count or both, I get the message retuned:

Cannot group on fields selected with'*'

If I look at the sql statement for the query, it does have a * in the sql string.

I am trying to "automatically delete duplicates" with a table append, but can't get through the steps.

Thanks for the help!

Robert
 
Robert,
The * character in a query means "All fields".
The Group By statements and aggregate functions in SQL need to know what fields to group on, which is the list of fields after the Group By keyword in the SQL. The reason it cannot group by on a select * is that the database engine can't check that the fields are selected so that they can be grouped when the query is run.

The way around it is to manually select all the fields that are in the table.

John

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top