Concatenate Multiple columns to one Row - Oracle 10.1
Hi Friends,
I have the item id in the item table and list of warehouses in another table.
SDM_ITEM_TABLE
ITM_ID ITM_DESC
1 Baby Oil
2 Shampoo
SDM_OUTBOUND_LOG
ITM_ID WHS_ID
1 1
1 2
1 3
1 4
2 1
2 2
SDM_OUTBOUND_DESC
WHS_ID WHS_SNAME
1 NJ
2 WN
3 CA
4 CN
Expected Result
ITM_ID WHS_SNAME
1 NJ WN CA CN
2 NJ WN
I am using the below query to join the above 3 tables , but i am unable to concatenate the warehouse short names as displayed above.
select t.itm_id,(SELECT H.WHS_SNAME FROM SDM_OUTBOUND_DESC H WHERE H.WHS_ID = t.WHS_ID) WHS_SNAME
from SDM_OUTBOUND_LOG t, SDM_ITEM_TABLE i
where t.itm_id = i.itm_id
Please let me know how to proceed further in modifying the query to concatenate the warehouse names.
Thanks