Good morning.
I created a view
to get concatenated multi-column data.
CREATE
ALGORITHM = UNDEFINED
DEFINER = 'root'@'localhost'
SQL SECURITY DEFINER
VIEW 'canal' AS
SELECT
'a'.'id_campaign' AS 'id_campaign',
'a'.'state' AS 'state',
CONCAT('id_dialing_list_number_',
'b'.'id_dialing_list') AS 'Num_Lista'
FROM
('campaign' 'a'
JOIN 'campaign_dialing_list' 'b' ON ('a'.'id_campaign' = 'b'.'id_campaign'))
WHERE
'a'.'state' = '3'
And it returns me this data:
d_campaign,state,Num_Lista
100,3,id_dialing_list_number_74
100,3,id_dialing_list_number_186
209,3,id_dialing_list_number_185
209,3,id_dialing_list_number_115
211,3,id_dialing_list_number_237
213,3,id_dialing_list_number_68
210,3,id_dialing_list_number_89
214,3,id_dialing_list_number_354
212,3,id_dialing_list_number_156
217,3,id_dialing_list_number_163
I would like to get the column Num_lista
and make an update in these tables.
Could someone give me a light?
Thank you.