You are here: Re: GROUP BY clause not working « PHP Programming Language « IT news, forums, messages
Re: GROUP BY clause not working

Posted by Bent Stigsen on 06/02/06 22:28

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация