Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:sql:statements:select:order_by [2010/07/03 22:30]
tdo
dev:sql:statements:select:order_by [2012/10/26 15:00] (current)
Line 8: Line 8:
  
 Depending on how a particular table is indexed, Omnidex will either perform a sort on the selected rows or use an Omnidex index. Depending on how a particular table is indexed, Omnidex will either perform a sort on the selected rows or use an Omnidex index.
- 
 ===== Syntax ===== ===== Syntax =====
  
Line 15: Line 14:
            [, column_spec | column_position ] [ ASC | DESC ]            [, column_spec | column_position ] [ ASC | DESC ]
 </​code>​ </​code>​
 +===== Discussion =====
 +The //​column_spec//​ can be in the form of [database_name.][table_name.]column_name. ​ The //​column_spec//​ can also be a column alias specified in the //​select_list//​ or the ordinal position of a column in the //​select_list//​.
 ===== Examples ===== ===== Examples =====
  
Line 43: Line 44:
   select trans_date, trans_amount - discount NetAmount from trans_table order by NetAmount;   select trans_date, trans_amount - discount NetAmount from trans_table order by NetAmount;
  
-Ascending ​{ASC), Descending (DESC)+Ascending ​(ASC), Descending (DESC)
 DESC (Descending) sorts will NOT be optimized, meaning they may increase the overall elapsed query time. ASC (Ascending) sorts may be optimized, depending on the index installation. Ascending is the default if neither is specified. DESC (Descending) sorts will NOT be optimized, meaning they may increase the overall elapsed query time. ASC (Ascending) sorts may be optimized, depending on the index installation. Ascending is the default if neither is specified.
  
 
Back to top
dev/sql/statements/select/order_by.1278196224.txt.gz ยท Last modified: 2012/10/26 14:58 (external edit)