【发布时间】:2016-10-17 03:06:11
【问题描述】:
我有
SELECT revision
FROM table
WHERE id = 4
ORDER BY revision DESC
LIMIT 1;
暂时忽略limit子句,结果如下:
Returns | I want
--------------------
Z | AD //with LIMIT clause this is what's returned
//& what I seek is the first row
//provided it's sorted properly
Y | AC
X | AB
W | AA
.... | Z
B | Y
A | X
AD | ....
AC | C
AB | B
AA | A
这可以用 MySQL 完成吗?
我的目标是按上述方式对数据进行排序。数据进入 PHP,我可以在其中重新排序,但我很好奇是否可以直接从 MySQL 执行此操作。
【问题讨论】:
标签: php mysql sorting sql-order-by collation