Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql order by column name with space

Tags:

mysql

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?

like image 986
imin Avatar asked May 20 '13 07:05

imin


2 Answers

Try enclosing them in back-ticks like

ORDER BY `Full Name` ASC

HTH

like image 144
Harsh Gupta Avatar answered Sep 19 '22 13:09

Harsh Gupta


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

like image 41
Þaw Avatar answered Sep 20 '22 13:09

Þaw