12 months AGO date
636380Aug 20 2009 — edited Aug 20 2009i have a ccan_dt(connection cancellation date) for every agent
i am trying to calculate the amount the agents spend before 12 months of connection cancellation date ie ccan_dt
agent ccandt
a 14/8/2009
b 12/7/2003
c 08/10/2000
d 7/8/1999
select sum(spend),agent from spendmas where spenddt between d1 and d2 group by agent
in the above d2 is the ccan_dt of each agent and d1 is 12 before date of d2
can any one suggest the efficinet way of acheving this.
i did this by creating a temp table to hold the dates and then calculated the spend.
but how can i achevie this with out creating a temp table.
is there any regular expression which can get 12 months ago date as in OBIEE.
please advice..