Re: where cluase help please
Date: Tue, 15 Jan 2008 07:14:13 -0800 (PST)
On Jan 15, 8:27 am, Totti <saliba.toufic.geo..._at_gmail.com> wrote:
> hi all. i want to Produce total sales per month per indicated
> The total should include only sales of products with more than
> 4,000,000 total sales.
> i did the following but it is giving me huge number:
> somebody please tell me why?
> SELECT TO_CHAR(purinv.Inv_Date,'mm') || ' - ' ||
> TO_CHAR(purinv.Inv_Date,'yy') as "MONTH",
> sum(decode(cust.region, 'West', sales.qty*salpmt.amount, 0)) as
> sum(decode(cust.region, 'North', sales.qty*salpmt.amount, 0)) as
> from prod, cust, salpmt, sales, purinv
> where salpmt.cust_code = cust.code
> and cust.region in ('North','West')
> and (sales.qty*salpmt.amount) > 4000000
> group by TO_CHAR(purinv.Inv_Date,'mm'),
> order by TO_CHAR(purinv.Inv_Date,'yy')
> thanks in advance
Why is there no mention, in your query, of item numbers or product ids? What is the criteria for matching the sales.qty to the salpmt.amount?
David Fitzjarrell Received on Tue Jan 15 2008 - 09:14:13 CST