item related productions in a row

Scenario is getting multiple production items for perticular item in a report.for this i wrote while select statement to get all records but it display only last value of the production item.and here all prodution ids are in a row for perticular item,

previously im checking with one item it works properly.for multiple items it wont give proper output

my query is like this

while select InventTable join prodBOM join ProdTable

where ProdBOM.ItemId == InventTable.ItemId

&& ProdTable.ProdId == ProdBOM.ProdId

{

Mfgoutputs = ProdTable.ItemId;

}

so pls suggest query for this

thanks in advance.