My table contains ID and ID1
ID ID1
5 8
6 9
7 1
Now The result set should like This
ID ID1
8 5
9 6
1 7
SELECT ID1 as 'ID'
, ID as 'ID1'
FROM <your table name>
If I understand you correctly it looks like you want to switch the field names.
select ID ID1, ID1 ID from tablename;
ID ID1
5 8
6 9
7 1
As you have mention you just want ID1 column first then ID so in select statement you have to specify ID1 column first,then ID like this.
SELECT ID1 'ID',ID 'ID1' FROM tablename;
so in above statement 'ID' is alias for ID1
and 'ID1' is alias for ID
.
If you are referring to the order of the columns in the output you can change it after the SELECT keyword:
SELECT a, b FROM ...
SELECT b, a FROM ...
The first query will have column a first, the second query will have column b first
精彩评论