Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 sqlite 数据库,其中有一列date名为DATETIME. 我用过这个:
date
DATETIME
cur.execute("SELECT * FROM Posts ORDER BY date(date) DESC")
然而,它给了我最老的第一个,我想要它反过来。我是 SQL 的新手,有人可以帮助我吗?
编辑:为了让任何想知道的人清楚,这是正确的答案:
cur.execute("SELECT * FROM Posts ORDER BY Date DESC")
希望这对某人有帮助!
我会建议你尝试相反:
cur.execute("SELECT * FROM Posts ORDER BY date ASC")
看看它是否有效。
希望这可以帮助!
创建数据库表时尽量不要使用“日期”字作为列名,因为该名称是为系统保留的,请尝试将名称从日期更改为另一个名称,然后再试一次。