Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 9

Using the Order By Clause to Logically Sort Rows

The Order By clause in a SQL Select statement will put the rows of the result set in a specified order.

The Order By clause contains one field name, or several field names separated by commas. If there are several field names, the major sort order starts with the first field name and works on down through the list of field names. The default sorting order for field names of any data type is Ascending (lowest to highest in numeric order and not case-sensitive alphabetic order for strings). You can specify descending order for any field in the Order By clause with the keyword DESC after the field name. In the following example, you order the employees by hire date (in Descending order), and then by last name: Select * From Employees Order By [Hire Date] DESC, [Last åName]

Although the default sorting order is Ascending order, you may specify Ascending order for clarity with the ASC keyword.

NOTE - Wildcard Characters Can Vary: The version of SQL in VB (known as "Jet SQL") uses different wildcard characters from the wildcard characters of standard SQL ("ANSI SQL"). In ANSI SQL, the single-character wildcard is the underscore (_), and the multicharacter wildcard is the percentage symbol (%). In Jet SQL, the wildcard is ? for single characters and * for multiple characters, the same as the wildcard characters used for filename specification in the DOS operating system.


  

<< Previous | Content | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved