I am trying to get a running total column in my query for year to date but I keep coming up with the error "missing expression" on my scalar subquery. Is there something I am missing? Can anyone help?
select a.region_cd, a.sales_person, b.category_id, a.corporate_cust_id,a.cust_id, sum(c.qty), sum(c.amount),
(select sum(c1.qty) from ps_l_sales_history c1
where c1.l_year = c.l_year
and c1.l_month = c.l_month
and c.l_year = 2000 and c.l_month <= 7) rt_balance
from ps_l_rep_cust a, ps_l_rep_item b, ps_l_sales_history c
where a.setid = c.setid and
a.cust_id = c.ship_to_cust_id and
b.setid = c.setid and
b.product_id = c.product_id and
b.category_id in ('L100', 'L200', 'S100', 'S200', 'C100', 'C200')
group by a.region_cd, a.sales_person, b.category_id, a.corporate_cust_id,
a.cust_id
Thanks in Advance,
Heather
select a.region_cd, a.sales_person, b.category_id, a.corporate_cust_id,a.cust_id, sum(c.qty), sum(c.amount),
(select sum(c1.qty) from ps_l_sales_history c1
where c1.l_year = c.l_year
and c1.l_month = c.l_month
and c.l_year = 2000 and c.l_month <= 7) rt_balance
from ps_l_rep_cust a, ps_l_rep_item b, ps_l_sales_history c
where a.setid = c.setid and
a.cust_id = c.ship_to_cust_id and
b.setid = c.setid and
b.product_id = c.product_id and
b.category_id in ('L100', 'L200', 'S100', 'S200', 'C100', 'C200')
group by a.region_cd, a.sales_person, b.category_id, a.corporate_cust_id,
a.cust_id
Thanks in Advance,
Heather