0 Replies Latest reply on Nov 21, 2012 7:22 AM by 963994

    extract last year sales amount and present year sales amount

      I am having a table inv_sales_trgt_val and columns are
      branch_cd number(3),
      vndr# number(3),
      yymm number(6) ,
      vgroup# number(3),
      sales_trgt_amt number(11,2),
      sales_actl_amt number(11,2),
      cuml_trgt_amt number(11,2),
      cuml_actl_amt number(11,2)

      select t.branch_cd,b.branch_e_name,t.vndr#,v.vndr_name,
      sum(nvl(t.sales_actl_amt,0)) sales_actl_amt
      from inv_sales_trgt_val t,branches b,vendor v where
      t.branch_cd=b.branch_cd and
      t.vndr#=v.vndr# and
      (t.yymm between :fiscal_month and :fiscal_month2) and
      (:fiscal_month<>trunc(:fiscal_month2,-2)) and :fiscal_month2<>trunc(:fiscal_month2,-2)) and t.branch_cd between :from_branch and to_branch and
      t.vndr# between :from_vndr and :to_vndr
      group by t.vndr#,v.vndr_name,t.branch_cd,b.branch_e_name
      order by t.vndr#,t.branch_cd;

      In report i need to extract last year sales amount, sum(sales_actl_amt) which is present year ,i am getting sum(sales_actl_amt) correct value. so from sales_actl_amt can i get last year value in report.

      please help me
      thank you.