Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL help!
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
![]() |
![]() |