在orcal数据库,sql 查询上月最后一天17:00以后的数据
就是说,如果给一个日期,2012-10-11,要查询的区间为:
2012-9-30 17:00:00至2012-10-11 17:00:00,取这个区间的值
求赐教
如何写sql语句的where条件
我用的是oracle 9 ,是不是没这个函数呀TRUNC()
出现下列错误
Caused exception message is: translate sql exception, message is
format sql error. target database is 'Oracle9' detail message is :
ERROR
source sql is :
select * from T_ATS_AutoSaleIssue where fdate between to_date('2012-9-30 17:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2012-10-11 17:00:00','YYYY-MM-DD HH24:MI:SS')
这条语句是不是写在一行? fdate是什么类型?是date类型吗?
追问是date类型
追答select * from T_ATS_AutoSaleIssue where fdate between to_date('2012-09-30 17:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2012-10-11 17:00:00','YYYY-MM-DD HH24:MI:SS') 月份不足2位用0补齐 这条语句是没有问题的,我在我oracle数据库试过了,只要你的fdate字段是date类型