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

Re: Problem with Query Max/Mix Values in Warehouses

$
0
0

Try this query:

 

Select t0.ItemCode [Kod Produktu],t1.ItemName [Nazwa towaru], sum (t0.OnHand) [W magazynie], sum (t0.onorder) [Zamowione], sum (t0.iscommited) [potwierdzone], sum(isnull(t0.MinStock,0)) [Min], sum (isnull(t0.MaxStock,0)) [Max],

sum ((t0.OnHand-isnull(t0.minStock,0))*(-1))[niedobor do min] ,case when sum(isnull(t0.MaxStock,0))=0 then 0 else sum (( t0.OnHand-isnull(t0.MaxStock,0))*(-1)) end [niedobor do max]

from OITW t0

join oitm t1 on t1.ItemCode=t0.ItemCode

and t0.WhsCode IN ('mz1','mz2','mz3','mz4') or (T0.WhsCode = 'wyr' and T0.MinStock >0)

GROUP BY t0.itemcode, t1.ItemName


Viewing all articles
Browse latest Browse all 3353

Trending Articles