Re: GROUP BY clause not working
- From: Bent Stigsen <ngap@xxxxxxxxxx>
- Date: Sat, 03 Jun 2006 00:28:31 +0200
Lorenzo Thurman wrote:
I'm using PHP 5 to make an ODBC connection to an MS Access database using PEAR and I'm getting DB Error: Syntax Error when using the GROUP BY clause. Here's my query:
SELECT * FROM HardwareInstallationsSummary WHERE LocationID = $loc_ID GROUP BY EquipmentTypeID
You have only told it *what* to group together, but it also needs to know *how* it should do it.
Just for kicks, I changed the GROUP BY to ORDER BY. The query works, and the items are sorted as expected, but this is not what I want. Is there a bug in here somewhere?
You need to spell it out for the ms-access thingy. As Janwillem mentions, you use aggregate functions for that, and there might be differences between different systems. So try at "comp.databases.ms-access", and give them a bit more information about the columns of the table you select from, and what you expect to happen.
/Bent
.
- References:
- GROUP BY clause not working
- From: Lorenzo Thurman
- GROUP BY clause not working
- Prev by Date: Re: GROUP BY clause not working
- Next by Date: sql for row where value=''
- Previous by thread: Re: GROUP BY clause not working
- Next by thread: include xmlrpc ...
- Index(es):
Relevant Pages
|