Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Populate information on each line returned of a select statement

$
0
0

Hi all,

SELECT     StockItem.Code, StockItem.Name, BinItem.confirmedQtyInStock , 
                      (CASE WHEN BinItem.BinName = 'W2' THEN BinItem.confirmedQtyInStock END) AS 'W2', StockItem.ItemID, Warehouse.Name AS Expr1,BinItem.BinName
FROM         StockItem INNER JOIN
                      BinItem ON StockItem.ItemID = BinItem.ItemID INNER JOIN
                      WarehouseItem ON StockItem.ItemID = WarehouseItem.ItemID AND BinItem.WarehouseItemID = WarehouseItem.WarehouseItemID INNER JOIN
                      Warehouse ON WarehouseItem.WarehouseID = Warehouse.WarehouseID
WHERE     ((BinItem.BinName = 'W2' OR
                      BinItem.BinName = 'Unspecified') AND (Warehouse.Name = 'WAREHOUSE'))and StockItem.Code LIKE 'MOVEit1%'

I have an enquiry in relation to a sql statement that I am trying to run..

I want to extract following information, stockCode,StockName,BinItem.ConfirmedQtyInStock,W2ConfirmedQtyInStock

So stockCodemStockName are straightforward enough....

BinItem.ConfirmedQtyInStock is the amount of stock in a particular bin at point in time.

W2ConfirmedQtyInStock is the amount of stock in a particualr bin at point in time.

The complicated bit is that I need to generate from the sql statement...1 line for each stockitem and binItem.ConfirmedQty in stock...but I need to see on the same line as this the W2ConfirmedQty in stock....and this is where the issue is..

At the moment I have a script which is showing me StockCode,StockName,BinItem.ConfirmedQtyInStock,W2ConfirmedQtyInStock

Script is in the code block section

Thanks a million for any help on this.

Best Regards


Aidan


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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