Move one row to the end of a result set in MySQL

I would like to move the row to the bottom of the result set, given the agreed condition.

Database

+-------+------------+ |Symbol | Percentage | |-------|------------| |VG | 20 | |-------|------------| |CASH | 20 | |-------|------------| |GOOG | 60 | +-------+------------+ 

for example: SELECT * FROM TableName -SEND TO END OF RESULT SET- WHERE symbol = 'CASH'

result set:

 GOOG VG CASH 

To clarify my initial question ...

I need to write an exception for the ORDER BY . To put a query in plain English - SELECT whole line, sorting by timestamp, unless the character is "CASH"

+4
source share
1 answer

To change the order of the rows in the result set, you must use ORDER BY:

 SELECT * FROM TableName ORDER BY symbol = 'CASH', timestamp 
+9
source

All Articles