Skip to Content
Mar 12, 2009 at 07:43 AM

Query for item warehouses stock in a row


hi all,

How to retreive item warehouse stock in a row using query ?

SELECT T0.ItemCode, T1.ItemName, T2.ItmsGrpNam, 
(Select WhsCode from OITW Where
WhsCode=T0.WhsCode and ItemCode=T0.ItemCode) as 'Wh',
(Select OnHand From OITW Where
Whscode = T0.WhsCode and Itemcode=T0.ItemCode) as 'Whstck' 
FROM OITW T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod 
WHERE T0.ItemCode NOT IN 'a-item'AND
T2.ItmsGrpNam LIKE '%%test%%' 
and T0.Onhand > 0 
ORDER BY T0.ItemCode

Anyone correct query so that it will retrieve item warehouse stock in a single row.