请教一个在sql语句中自动获得当前日期的问题!!!
各位大虾们,帮我看下我的语句吧?select*
where (*)
and (*)
and (*)
and (*)
and (bss_datetimes.date_and_time>="2007-09-13 18:00")
and (bss_datetimes.date_and_time<="2007-09-11 23:00")
order by *,*
!
这段代码中(bss_datetimes.date_and_time>="2007-09-13 18:00")
and (bss_datetimes.date_and_time<="2007-09-11 23:00")这部分划定的时间是从9月11号到9月13号三天中每天的18点到23点这几个时段,我现在想让它每天自动跳变为当前日期的前三天到前一天这个日期范围,应该怎么做啊?每天手动改的太麻烦!
先谢谢各位了。 select*
where (*)
and (*)
and (*)
and (*)
and (bss_datetimes.date_and_time>=to_char(current,"%Y-%m-%d")||" 18:00")
and (bss_datetimes.date_and_time<=to_char((current - interval(3) day to day),"%Y-%m-%d")||" 23:00"
)
order by *,*
有关CRON的配置问题
前阵子在坛子里发帖问用SELECT语句取得当前日期的问题,在liaosnet大哥的热心帮助下以成功调试过去,代码已经写到如下阶段,我想配置一下CRON服务,让系统每天凌晨4点自动运行,怎么弄啊?哪位大哥能帮下小弟啊?dbaccess omc_db<<!
unload to "/home/omcadmin/yerui/ttt/pm.txt"
select*
where (*)
and (*)
and (*)
and (*)
(bss_datetimes.date_and_time>=to_char(current year to day - interval(1) day to day,"%Y-%m-%d")||" 09:00")
and (bss_datetimes.date_and_time<=to_char(current year to day - interval(1) day to day,"%Y-%m-%d")||" 10:00")
order by *,*
[ 本帖最后由 tnt4913 于 2007-10-29 17:42 编辑 ] 可以把上述内容编辑为一个SHELL文件mycrontab.sh,如果可执行dbaccess的用户具有CRON权限,则直接用
crontab -e 命令执行,编辑其内容如:
04***mycrontab.sh
如果该用户没有授予CRON权限,除了开放权限外,也可以在root用户执行:
#crontab -e命令,编辑CRONTAB内容如下:
04* * * su - dbuser -c "/dir_name/mycrontab.sh"
dbuser是可执行dbaccess的数据库用户。
页:
[1]