Please help -
Why can I get this sql to work?

SELECT Count(dsd.price) Total
, dsd.reporting_date
, dsd.reporting_state_type
, dsd.requisition_id Order_id
, round((sum(decode(dsd.reporting_state_type,'SHIPMENT',dsd.price, 0)) - sum(decode(dsd.reporting_state_type,'RETURN_RECEIPT',dsd.price, 0))) Net_Orders
from dw_sales_data dsd, dw_programs dp
where dsd.program_id = dp.program_id
and dsd.program_id = '4387300'
group by dsd.reporting_date, Order_id, dsd.reporting_state_type, Net_Orders_Com, Net_Orders_Ret, Net_Orders;

SELECT Count(dsd.price) Total
, dsd.reporting_date
, dsd.reporting_state_type
, dsd.requisition_id Order_id
, round(sum(decode(dsd.reporting_state_type,'SHIPMENT',dsd.price, 0)) - sum(decode(dsd.reporting_state_type,'RETURN_RECEIPT',dsd.price, 0))) Net_Orders
from dw_sales_data dsd, dw_programs dp
where dsd.program_id = dp.program_id
and dsd.program_id = '4387300'
group by dsd.reporting_date, Order_id, dsd.reporting_state_type, Net_Orders_Com, Net_Orders_Ret, Net_Orders;

ORA-00907: missing right parenthesis
Cause: A left parenthesis has been entered without a closing right parenthesis, or extra information was contained in the parentheses. All parentheses must be entered in pairs.
Action: Correct the syntax and retry the statement.

It looks like you had an extra left parentheses

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.