我不得不在这里做出很多假设,因为您还没有真正写过问题,甚至没有提供任何信息。
您说“列的内容”,所以我假设您将这 3 个 HTML 段落标签存储在某个数据库的列中,并且您想更改它们的返回顺序。
您想要的顺序不是字母顺序,因此您不能按存储的值对它们进行排序。您应该创建一个新列并对其进行排序,例如创建一个名为“manual_order”的列,然后:
SELECT * FROM table
ORDER BY manual_order
编辑
您对帖子的更新清楚地表明了您正在尝试做什么 - 当“您”知道您的意思但对其他人并不总是清楚时,它总是更容易!
除非您提供 ORDER BY 子句,否则不能依赖从 MySQL 返回的结果的顺序。
SELECT * FROM table
如果您没有对该表进行任何删除/更新或替换,则将按插入顺序返回。
如果您使用 INNODB 表执行 SELECT * FROM 表,它们将按 PRIMARY KEY 顺序而不是 INSERT 顺序返回。
If you want to change the order you must supply an ORDER BY clause. If you want an order that doesn't make sense in numeric terms then as suggested it would be best to create another column where you can specify the order and use that in the ORDER BY clause.
If you're using INNODB and wanting a reverse of what has been queried you could just use:
SELECT * FROM table
ORDER BY primarykey DESC