【发布时间】:2015-10-09 14:30:42
【问题描述】:
我想根据我的数据库表 [note] 字段“date_created”获取上个月的记录。
执行此操作的 sql 是什么?
上个月 - 2015-08-30 到 2015-09-30
我使用了以下来自链接的查询,但 get last three month records from table 但得到错误 ORA-30089: missing or invalid
select *
from note
where to_date(DATE_CREATED) > to_date(CURRENT_DATE) - to_date(INTERVAL '3 months')
即使我使用了以下查询,但仍然出现错误:ORA-01861:文字与格式字符串不匹配
select *
from note
where to_date(DATE_CREATED) BETWEEN '2015-08-30 00:00:00.0' AND '2015-09-30 00:00:00.0'
【问题讨论】:
-
你使用的是 SQL-Server?
-
这是oracle首席ORA-....
-
这必须是 2018 版本,存在 ORA 错误
-
DATE_CREATED 列的数据类型是什么?