|
Transact-SQL User's Guide
|
Rearranging
the order of columns
The
order in which you list the column names in the select clause determines
the order in which the columns display. The examples that follow
show how to specify column order, displaying publisher names and identification
numbers from all three rows in the publishers table.
The first example prints pub_id first,
followed by pub_name; the second reverses that
order. The information is the same but the organization changes.
select pub_id, pub_name
from publishers
pub_id pub_name
----- ---------------
0736 New Age Books
0877 Binnet & Hardley
1389 Algodata Infosystems
(3 rows affected)
select pub_name, pub_id
from publishers
pub_name pub_id
--------------------- ------
New Age Books 0736
Binnet & Hardley 0877
Algodata Infosystems 1389
(3 rows affected)