Hi Guys,
I am back with 3rd tutorial of SQL400. After going through this blog, I hope all of you would be having basic understanding of SQL400
SQL ORDER BY
‘ORDER BY’ is used to list the output in a particular order. This could be in ascending order, in descending order, or could be based on either numerical value or text value.
The syntax for an ORDER BY statement is as follows:
SELECT "column_name" FROM "table_name" [WHERE "condition"] ORDER BY"column_name" [ASC, DESC]
It is possible to order by more than one column.
ORDER BY "column_name1" [ASC, DESC], "column_name2" [ASC, DESC]
SELECT * FROM TBLSTR ORDER BY STRNAM
The above statement will select all records from file TBLSTR and sort them based upon the ascending values of column STRNAM