[英]How do you organize an SQL database depending on a specific value?
I have a MySQL database holding a few columns ('a', 'b', 'c', 'd'). 我有一个包含几列('a','b','c','d')的MySQL数据库。 I want to echo the table in descending order according to 'd', an integer. 我想按照d的降序回显该表。
For example, the existing table: 例如,现有表:
+------------+---------+-------------+----+
| A | B | C | D |
+------------+---------+-------------+----+
| Lorem | Ipsum | Dolor | 7 |
| Sit | Amet | Consectetur | 4 |
| Adipiscing | Elit | Sed | 13 |
| Do | Eiusmod | Tempor | 1 |
| Incididunt | Ut | Labore | 6 |
+------------+---------+-------------+----+
What should be outputted: 应该输出什么:
+------------+---------+-------------+----+
| A | B | C | D |
+------------+---------+-------------+----+
| Adipiscing | Elit | Sed | 13 |
| Lorem | Ipsum | Dolor | 7 |
| Incididunt | Ut | Labore | 6 |
| Sit | Amet | Consectetur | 4 |
| Do | Eiusmod | Tempor | 1 |
+------------+---------+-------------+----+
How do I go about doing this? 我该怎么做呢?
SELECT a, b, c, d
FROM table
ORDER BY d DESC;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.