我有一个MySQL数据库,其中包含几列(' a'''' c'' d')。我想根据' d',一个整数来按照降序回显表。
例如,现有表格:
+------------+---------+-------------+----+
| A | B | C | D |
+------------+---------+-------------+----+
| Lorem | Ipsum | Dolor | 7 |
| Sit | Amet | Consectetur | 4 |
| Adipiscing | Elit | Sed | 13 |
| Do | Eiusmod | Tempor | 1 |
| Incididunt | Ut | Labore | 6 |
+------------+---------+-------------+----+
应该输出什么:
+------------+---------+-------------+----+
| A | B | C | D |
+------------+---------+-------------+----+
| Adipiscing | Elit | Sed | 13 |
| Lorem | Ipsum | Dolor | 7 |
| Incididunt | Ut | Labore | 6 |
| Sit | Amet | Consectetur | 4 |
| Do | Eiusmod | Tempor | 1 |
+------------+---------+-------------+----+
我该怎么做?
答案 0 :(得分:7)
SELECT a, b, c, d
FROM table
ORDER BY d DESC;