Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 rows are repeated

Author  Topic 

puppy
Starting Member

5 Posts

Posted - 2013-12-17 : 03:12:45
for the below mentioned query their is repetition of rows with the same data.Please help

SELECT srs.prod_area as PA,
srs.art as ArtNo,
b.adsc_unicode as ArtName,
cast(case when a.unit <> '2' then c.avsx/10 else c.avsx/1000 end as integer(2)) as AwsMHS,
cast(srs.estimate/10 as integer(1)) as AwsSRSThisWeek,
cast(case when a.unit <> '2' then c.exws/10 else c.exws/1000 end as integer(2)) as ExpSale,
a.palq as PalletQty,
a.mdq as MinDeliveryQty,
skf.min_salesplace_size as MinSalesspaceSize,
skf.min_qty_for_direct_flow as MinQtyForDirectFlow,
CAST(skf.MATH_SAFETY_STOCK as integer(1) )as MathSafetyStock,
Decode(skf.salesplace_flow_type, NULL, 'Not in SRS', '0', 'Missing', '1', 'Too small', '2', 'Indirect', '3', 'Direct', '4', 'Too big', skf.salesplace_flow_type) as FlowType,
skf.sugg_salesplace_size as SuggestedSize,
c.bulk as SalesMethod,
a.auto as StockRepl,
a.stpo as SalesLocation,
a.mupq as MultipackQty,
a.salesspace_code as SalesSpaceCode,
a.salesplace_size as SalesSpaceCapacity,
skf.lowest_sales_qty as LowestSalesQty,
skf.max_salesplace_size as MaxSalesplaceSize,
a.goods_dom as QtyGoodsDom,
si.from_date as FromDate,
si.to_date as ToDate,
si.MSG_CODE_TEXT || si.FREE_TEXT as CentralSalesInfo,
a.delivery_max as DelMax
from srs_key_figures skf, srs_articles srs, iwaaa a, iwaab b, iwaac c, availability_msg si
where c.bulk in ('0','1','2')
and b.iso = 'SE'
and srs.art = c.art
and srs.art = b.art
and srs.art = a.art
and srs.art = skf.art (+)
and srs.art = si.item_no
order by srs.prod_area, srs.art;

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2013-12-17 : 03:26:19
Are you using Oracle or SQL Server?

Its just that if you want people to re-write your code, they are likely to rewrite it in T-SQL on this site and you might be better off visiting an Oracle forum if you want the code someone writes to work for you.
Go to Top of Page

puppy
Starting Member

5 Posts

Posted - 2013-12-17 : 04:04:13
Im using SQL Server
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2013-12-17 : 04:26:06
Decode() is Oracle, not SQL Server, so think you may need to check what you are using.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-17 : 07:54:54
your posted code is in Oracle as I can see below

..
si.MSG_CODE_TEXT || si.FREE_TEXT
..
and srs.art = skf.art (+)..

which are not supported in T-SQL

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -