日期:2014-05-17  浏览次数:20649 次

求教这句sql什么意思。。。


select distinct 
       a.os_username os_user,
       a.userhost,
       a.username db_user,
       to_char(a.timestamp,'yyyy-mm') Year_Month,
       a.action_name action_name       
from   dba_audit_trail a
where  a.timestamp >= to_date(to_char(sysdate,'yyyymm')-1||'16','yyyymmdd') 
and    a.timestamp < to_date(to_char(sysdate,'yyyymm')||'01','yyyymmdd')
and          a.action in (100)
order by a.action_name

select distinct 
       a.os_username os_user,
       a.userhost,
       a.username db_user,
       to_char(a.timestamp,'yyyy-mm') Year_Month,
       a.action_name action_name       
from   dba_audit_trail a
where  a.timestamp >= to_date(to_char(sysdate,'yyyymm')||'01','yyyymmdd') 
and    a.timestamp < to_date(to_char(sysdate,'yyyymm')||'16','yyyymmdd')
and          a.action in (100)
order by a.action_name

求教这几句话是什么意思???

------解决方案--------------------
timestamp >= 本月一号
timestamp <  本月十六号
------解决方案--------------------
引用:
Quote: 引用:

这不就是普通的sql吗。。。。
有啥特殊,难懂的地方?

where  a.timestamp >= to_date(to_char(sysdate,'yyyymm')
------解决方案--------------------
'01','yyyymmdd') 
and    a.timestamp < to_date(to_char(sysdate,'yyyymm')
------解决方案--------------------