我现在有日期列的查询我必须将参数传递给这个单一的查询,比如年,季度,月。通过级联列表框。所以如何根据参数改变这个查询..
my query:
select distinct
OUTLET_NAME,
ROUND (nvl(sum(WALKIN_WITHOUT_CGROUP),0)/ COUNT(*),2)APC,
ROUND((nvl(SUM(SALES_VALUE),0)+nvl(sum(total_sales),0)-nvl(sum(net_sales),0)+nvl(sum(discount),0))/nvl(sum(BILLS_WITHOUT_CGROUP),0))ASPB,
ROUND((nvl(SUM(SALES_VALUE),0)+nvl(sum(total_sales),0)-nvl(sum(net_sales),0)+nvl(sum(discount),0))/COUNT(*),2) ASPD,
nvl(sum(BILLS_WITHOUT_CGROUP),0) Bill,
trunc(nvl(SUM(SALES_VALUE),0)+nvl(sum(total_sales),0)-nvl(sum(net_sales),0)+nvl(sum(discount),0)) Sale,
nvl(sum(WALKIN_WITHOUT_CGROUP),0) WALKINS
from OUTLET_PAYMODE_REPORT_FACT A,OUTLET_DETAILS B
WHERE A.OUTLET_ID=B.OUTLET_ID and SALES_VALUE>0
and tran_date between '01-Apr-2012' and '31-Mar-2013'
group by OUTLET_NAME