Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL help!

Re: SQL help!

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 21 Jul 1999 04:38:11 GMT
Message-ID: <7n3irj$4g4$9@news.seed.net.tw>

Jerry Gitomer <jgitomer_at_hbsrx.com> wrote in message news:7mvjbh$54d$1_at_autumn.news.rcn.net...
> If I understand your problem correctly the following should
> do the trick.
> SELECT ty.week_nbr,
> ty.week_dsc,
> ty.store_nbr,
> ty.store_name,
> ly.sum(nvl(regsales,0)) as ly_reg_sales,
> ty.sum(nvl(regsales,0)) as ty_reg_sales,
> ly.sum(nvl(regunits,0)) as ly_reg_units,
> ty.sum(nvl(regunits,0)) as ty_reg_units,
> ly.sum(nvl(promosales,0)) as ly_promosales,
> ty.sum(nvl(promosales,0)) as ty_promosales,
> ly.sum(nvl(promounits,0)) as ly_promounits,
> ty.sum(nvl(promounits,0)) as ty_promounits
> FROM RSNET.JC_STORE_BY_WEEK ty,
> RSNET.JC_STORE_BY_WEEK ly
> WHERE ty.week_nbr >= 199828
> AND ty.week_nbr <=199927
> AND ly.week_nbr = ty.week_nbr + 100
> AND ty.store_nbr = ly.store_nbr
> GROUP BY ty.week_nbr, ty.week_dsc, ty.store_nbr, ty.store_name
> ORDER BY ty.week_nbr, ty.store_nbr

If you do so, the Cartesian's Product will take effect. The sum would be multiple of the real values. Received on Tue Jul 20 1999 - 23:38:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US