Order by problem
Posted: Mon 20 Nov 2006 14:40
We have a strange behaviour in the following SQL statement:
In the query Analyzer of the SQL Server 2000, it gets to the following, correct result:
If I run EXACTLY THE SAME statement in a TSimpleDataset in Delphi, using the dbexpress driver for MSSQL (dbxsda200.exe), the order is wrong. It gets to the following:
Is this a bug?
Code: Select all
SELECT
TruckPlanningList.VBELN_VL, TruckPlanningList.ActivationDate, HostState.HostStateId, HostState.Name AS HostStateName
FROM
TruckPlanningList with(nolock)
INNER JOIN
HostState with(nolock) ON TruckPlanningList.HostStateId = HostState.HostStateId
order by
HostState.Name, TruckPlanningList.ActivationDate
Code: Select all
VBELN_VL ActivationDate HostStateId HostStateName
---------- ------------------------------------------------------ -------------------- --------------------------------------------------
ABCDE12346 2006-11-20 14:50:05.977 1 Active
ABCDE12345 NULL 0 Inactive
(2 row(s) affected)
Code: Select all
VBELN_VL ActivationDate HostStateId HostStateName
---------- ------------------------------------------------------ -------------------- --------------------------------------------------
ABCDE12345 NULL 0 Inactive
ABCDE12346 2006-11-20 14:50:05.977 1 Active
(2 row(s) affected)