#26479 [Opn->Bgs]: ORDER BY clause not sorting results
| From: | sniper@php.net | Date: | Mon, 01 Dec 2003 07:24:06 +0000 |
| Subject: | #26479 [Opn->Bgs]: ORDER BY clause not sorting results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51423@lists.php.net to get a copy of this message | ||
ID: 26479
Updated by: sniper@php.net
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