I have this query in MSSQL:
UPDATE [dbo].[sliders_item]
SET AdminCategoryLabel = st.Title
from [dbo].[sliders_item] si
inner join [dbo].[sf_content_link] cl on si.base_id = cl.parent_item_id
inner join [dbo].[sliders_type] st on cl.child_item_id = st.base_id
Wich works well when sf_content_link
have one record with si.base_id = cl.parent_item_id
.
I have to update AdminCategoryLabel
using the connection table sf_content_link
for the case when sf_content_link
have many records with si.base_id = cl.parent_item_id
. Somehow i have to select all the Titles
from sliders_type
and concatenate them to replace the current st.Title
wich takes only first record.
Any idea how to do that?
The tables designs are:
sliders_item
:base_id
,AdminCategoryLabel
sliders_type
:base_id
,Title
sf_content_link
:id
,parent_item_id
(FK forsliders_item base_id
),child_item_id
(FK forsliders_type base_id
).