elbarna
elbarna

Reputation: 771

Mysql,how to change "order" of this query?

I run this query(it's a test db,so don't laugh for name of columns)

mysql> select concat (SPACE(temperature),city) as city,temperature from tableexample order by temperature desc;
+------------------------------------------+------------+
| city                                     | temperature|
+------------------------------------------+------------+
|                                Cape Town |         32 |
|                       Paris              |         22 |
|                Rome                      |         15 |
|             New York                     |         12 |
|            London                        |         11 |
+------------------------------------------+------------+
5 rows in set (0,00 sec)

If I remove SPACE,the output put the number before City

I want an output like this,how to do?

+-------------------------+
| city      | temperature |
+-------------------------+
|Cape Town  |         32  |
|Paris      |         22  |
|Rome       |         15  |
|New York   |         12  |
|London     |         11  |
+-------------------------+

Upvotes: 0

Views: 48

Answers (1)

Alexis.Rolland
Alexis.Rolland

Reputation: 6361

You can just type:

select city,temperature from tableexample order by temperature desc;

Upvotes: 1

Related Questions