在like 后面用系统变量来完成模糊查询

select * from
(select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu7 from SANDBOXUSER.BMC_CPU
where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 18), 'yyyy/mm/dd hh24:mi' )
AND TO_CHAR ( trunc(SYSDATE - 17), 'yyyy/mm/dd hh24:mi' )
group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
where  mi like TO_CHAR(trunc(SYSDATE - 18),'yyyy/mm/dd')||'%'//这是一个知识点

posted @ 2011-07-27 11:35  八神吻你  阅读(406)  评论(0编辑  收藏  举报