我有一个以小时方式在查询下运行的任务。如果错过查询,这会消耗大量时间并且存在风险。有人可以帮助我优化查询是动态的,所以我不必每次都编辑时间和日期吗?
select ((
select count(*) from table_a
where column_a = some value
and date between '23-NOV-15 05:00:00' and '23-NOV-15 05:59:59')
+
(select count(*) from table_b
where column_b = some value
and date between '23-NOV-15 05:00:00' and '23-NOV-15 05:59:59'))