6

here's what I'm trying to do

SELECT id,`Full Name`,`Social Number` FROM data ORDER BY 'Full Name' ASC 

but it seems the order by Full Name ASC doesn't work. I think it's most probably because of the name which has space. any remedy to this problem?

4

4 回答 4

9

Try enclosing them in back-ticks like

ORDER BY `Full Name` ASC

HTH

于 2013-05-20T07:44:49.877 回答
4

try ORDER BY 2 ASC 2 refers to the second selected column which is FULL NAME

于 2013-05-20T07:49:03.153 回答
2

This is because you don't have to surround columns with quote ', you might use backtick `. Simply change as follow:

SELECT id,`Full Name`,`Social Number` FROM data ORDER BY `Full Name` ASC 
                                                         ^         ^
                                                         You need to change those
于 2013-05-20T07:44:26.717 回答
1

You are using ' around the column name which is invalid

SELECT id,`Full Name`,`Social Number` FROM data ORDER BY `Full Name` ASC
于 2013-05-20T07:44:11.223 回答