ID: 26479 Updated by: [EMAIL PROTECTED] Reported By: andrew at howsfamily dot net -Status: Open +Status: Bogus Bug Type: ODBC related Operating System: Windows XP Pro PHP Version: 4.3.2 New Comment:
Not PHP bug. Previous Comments: ------------------------------------------------------------------------ [2003-11-30 20:42:08] andrew at howsfamily dot net Description: ------------ When running a query, the ORDER BY clause seems to be ignored. ODBC is connecting to MS Access via the standard MS driver. When the query is run in a MS Access query, it sorts correctly. When the resultset is returned via the PHP ODBC functions, however, the rows are returned in the order they were created, not the order specified by the ORDER BY clause. Reproduce code: --------------- SELECT Person.Surname, Person.[Given Name(s)], Owing - IIF(Payments.Total IS NULL, '0', Payments.Total) AS Amount FROM Person, Registration, (SELECT Registration.Surname, Registration.[Given Name(s)], SUM(Amount) AS Total FROM Registration LEFT OUTER JOIN Receipt ON (Registration.Camp = Receipt.Camp) AND (Registration.Surname = Receipt.Surname) AND (Registration.[Given Name(s)] = Receipt.[Given Name(s)]) WHERE Registration.Camp='Summer Camp 2003' GROUP BY Registration.Surname, Registration.[Given Name(s)], Registration.Owing) AS Payments WHERE Person.[Given Name(s)] = Registration.[Given Name(s)] AND Person.Surname = Registration.Surname AND Person.[Given Name(s)] = Payments.[Given Name(s)] AND Person.Surname = Payments.Surname AND Camp = 'Summer Camp 2003' AND (Owing - IIF(Payments.Total IS NULL, '0', Payments.Total)) > 0 AND Person.[Given Name(s)] = Registration.[Given Name(s)] AND Person.Surname = Registration.Surname ORDER BY Person.Surname Expected result: ---------------- SURNAME GIVEN NAME(S) AMOUNT ------------------------------------------- Aardvark Fred $130.00 Badger Bob $150.00 Dalmation Jim $150.00 Actual result: -------------- SURNAME GIVEN NAME(S) AMOUNT ------------------------------------------- Aardvark Fred $130.00 Dalmation Jim $150.00 Badger Bob $150.00 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26479&edit=1