Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8459

Re: Query correction

$
0
0

i try like below method , But not working

 

Select b.Located, b.ItemCode,b.ItemName,b.BatchNum,b.WhsCode,b.Quantity,b.InDate,

b.CardName,b.BaseType,b.BaseNum,

isnull(case when b.overdue <30 then b.InDate end,0)'0-30 Days' ,

isnull(case when b.overdue between 30 and 60 then b.InDate end,0) '30-60 Days',

isnull(case when b.overdue between 60 and 90 then b.Indate end,0) '60-90 Days',

 

 

from ( Select a.Located, a.ItemCode,a.ItemName,a.BatchNum,a.WhsCode,a.Quantity,a.InDate,

a.CardName,a.BaseType,a.BaseNum,"overdue" = datediff(d,getdate(),InDate)

 

 

from(

 

 

 

 

Select Located, ItemCode,ItemName,BatchNum,WhsCode,Quantity,InDate, (CASE WHEN OIBT.CardCode IS NULL  THEN

(SELECT  a.CardCode FROM OITM a where a.ItemCode =OIBT.ItemCode)Else  OIBT.CardCode END) as CardCode,

CardName,BaseType,BaseNum,"overdue" = datediff(d,getdate(),InDate) from OIBT

 

 

Where

Quantity <> 0 and WhsCode in ('ExEngQur','ExQuaQur','ExQuaran','ExSupRet')

  Order By

Located,WhsCode, ItemCode


Viewing all articles
Browse latest Browse all 8459

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>