SELECT Table.date FROM Table WHERE date > current_date - 10;
这对 PostgreSQL 有效吗?
最佳答案
是的,这在 PostgreSQL 中有效(假设列“date”的数据类型为 date
)
为什么不试试呢?
标准的 ANSI SQL 格式是:
SELECT Table.date
FROM Table
WHERE date > current_date - interval '10' day;
我更喜欢这种格式,因为它使事情更容易阅读(但它与 current_date - 10
相同)。
关于sql - 如何列出最近 10 天的记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5465484/