[英]Oracle sql developer date/month data extract query and syntax
I Want to extract data from a table for monthwise in oracle sql.我想从 oracle sql 的表中按月提取数据。 I tried it as follow, SELECT * From customer ct Where ct.
我尝试如下,SELECT * 来自客户 ct Where ct. Application_signed _date in (Date '31-12-2020, Date '01-10-2020')
Application_signed _date in(日期'31-12-2020,日期'01-10-2020')
But i am unable to Fetch the data for this range, whereas data is available for this months.但我无法获取此范围的数据,而本月的数据可用。
The correct format for a date in Oracle -- and almost everywhere else -- is YYYY-MM-DD: Oracle 以及几乎所有其他地方的日期的正确格式是 YYYY-MM-DD:
select *
From customer ct
where ct.Application_signed_date in (Date '2020-12-31, Date '2020-10-01')
Note that Oracle dates can have time components.请注意,Oracle 日期可以有时间分量。 If that is possible in your data, then one fix is:
如果这在您的数据中是可能的,那么一种解决方法是:
where trunc(ct.Application_signed_date) in (Date '2020-12-31, Date '2020-10-01')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.