If I submit the following SQL statement to a database:
SELECT setting_value
FROM dba.system_settings
WHERE setting_name = 'RequestWebServiceURL'
OR setting_name = 'UNITS'
OR setting_name = 'FACTOR'
I get results in this order:
setting_value
---------------
www.requestURL
1
degrees
Even though I had specified “UNIT” before “FACTOR” in the SQL.
The table is, however, sorted by setting_name, which is why I got results in this order. May be a silly question but the order of the result based on the above query be preserved? Database in this case is Sybase.
The ANSI means would be to use a CASE expression in the
ORDER BYclause:An
ORDER BYclause is the only means of guaranteeing result set order. Otherwise, you’re likely to see insertion order.