将一行移动到MySQL中结果集的末尾(move one row to the end of a result set in MySQL)
在给定匹配条件的情况下,我想将行移动到结果集的底部。
数据库
+-------+------------+ |Symbol | Percentage | |-------|------------| |VG | 20 | |-------|------------| |CASH | 20 | |-------|------------| |GOOG | 60 | +-------+------------+澄清我原来的问题......
我需要为ORDER BY语句编写一个异常。 将查询放入普通英语 - SELECT整行,按时间戳排序,除非符号为“CASH”
I would like to move a row to the bottom of the result set given a matched condition.
Database
+-------+------------+ |Symbol | Percentage | |-------|------------| |VG | 20 | |-------|------------| |CASH | 20 | |-------|------------| |GOOG | 60 | +-------+------------+To clarify my original question...
I need to write an exception for an ORDER BY statement. To put the query into plain english - SELECT an entire row, ordering by a timestamp, except if the symbol is "CASH"
最满意答案
要更改结果集中行的顺序,您应该使用ORDER BY:
SELECT * FROM TableName ORDER BY symbol = 'CASH', timestampTo change the order of the rows in a result set you should use ORDER BY:
SELECT * FROM TableName ORDER BY symbol = 'CASH', timestamp更多推荐
发布评论