Question : Sql Query

Instead of where li.trade_date ='07-JULY-10' i want to see last month data.Please let me know how to check that.something like between '07-June-10 to '07-july-10' with doing same calculation as we do for single day like li.trade_date ='07-JULY-10'.

select sess.EXCHANGE,
       sess.REGION,
       '('||trim(sd.DATA_CENTER)||')',
       max(li.latency_micro_sec) AS max_latency ,
       min(li.latency_micro_sec) AS min_latency,
       round(avg(li.latency_micro_sec),2) AS avg_latency,
       round(median(li.latency_micro_sec),2) AS med_latency,
       round(stddev(li.latency_micro_sec),2) AS stddev_latency
from latency_info li,
     threshold_lookup tl,
     xl_sessions sess,
     server_master sm,
     server_details sd, owner o
where li.trade_date ='07-JULY-10'
and   tl.instance = li.INSTANCE
and   sess.INSTANCE = li.INSTANCE
and   o.OWNER_ID = sm.OWNER_ID
and sm.OWNER_ID = sd.OWNER_ID(+)
and sm.SERVER_NAME = sd.SERVER_NAME(+)
and sm.SERVER_NAME = li.HOSTNAME
and sess.INSTANCE not in('BRK%')
and li.LATENCY_MICRO_SEC < 100000
and o.owner_name not in('Chan,Cindy')
and o.OWNER_TYPE = 'T'
group by li.trade_date, sess.EXCHANGE,sess.REGION,trim(sd.DATA_CENTER)

Answer : Sql Query

Thank you for the clarification.  I get you now.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
select sess.EXCHANGE,
       sess.REGION,
       '('||trim(sd.DATA_CENTER)||')',
       max(li.latency_micro_sec) AS max_latency ,
       min(li.latency_micro_sec) AS min_latency,
       round(avg(li.latency_micro_sec),2) AS avg_latency,
       round(median(li.latency_micro_sec),2) AS med_latency,
       round(stddev(li.latency_micro_sec),2) AS stddev_latency
from latency_info li,
     threshold_lookup tl,
     xl_sessions sess,
     server_master sm,
     server_details sd, owner o
where li.trade_date BETWEEN add_months(TRUNC(SYSDATE),-1) AND SYSDATE
and   tl.instance = li.INSTANCE
and   sess.INSTANCE = li.INSTANCE
and   o.OWNER_ID = sm.OWNER_ID
and sm.OWNER_ID = sd.OWNER_ID(+)
and sm.SERVER_NAME = sd.SERVER_NAME(+)
and sm.SERVER_NAME = li.HOSTNAME
and sess.INSTANCE not in('BRK%')
and li.LATENCY_MICRO_SEC < 100000
and o.owner_name not in('Chan,Cindy')
and o.OWNER_TYPE = 'T'
group by sess.EXCHANGE,sess.REGION,trim(sd.DATA_CENTER)
Random Solutions  
 
programming4us programming4us