Sample Header Ad - 728x90

MySQL Join two tables with comma separated values

-2 votes
2 answers
7101 views
I've got two tables as below: CARLINE |option_value |option_name| |------------------|-----------| |tipologia_auto_1 |Citycar | |tipologia_auto_2 |Berlina | |tipologia_auto_3 |SUV | |Hobby_1 |football | |Hobby_2 |Basket | Datimarketing (is the result of group concat of previous columns) |Hobby | Car Type | Datimarketing | |--------|------------------------------------|---------------------------------| |Hobby_1 | tipologia_auto_2, tipologia_auto_3 | Hobby_1, tipologia_auto_2, tipologia_auto_3| I am looking to query my Carline table and associate the 'option_name' column with values from the Datimarketing table. The output should be: |Hobby | Car Type | Datimarketing | |--------|--------------|-----------------------| |footbal | Berlina, SUV | football, Berlina, SUV| Can this be accomplished by CONCAT or FIND_IN_SET? Please help! Thanks in advance!
Asked by Francesco Marcucci (1 rep)
Dec 24, 2020, 10:01 AM
Last activity: Dec 28, 2020, 11:04 AM