How to extend list in mysql with another list?


by domenico , in category: MySQL , a month ago

How to extend list in mysql with another list?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by darion , a month ago


To extend a list in MySQL with another list, you can use the CONCAT function to concatenate the two lists together. Here is an example:

Assuming you have a table called list_table with a column called list_column that contains the original list and you want to extend it with another list:

UPDATE list_table
SET list_column = CONCAT(list_column, ',list_item1,list_item2,list_item3')
WHERE condition;

In this query, list_item1, list_item2, and list_item3 are the items you want to add to the original list. Make sure to replace list_table, list_column, list_item1, list_item2, list_item3, and condition with the actual table name, column name, list items, and condition for updating the specific row(s) in the table.

This query will concatenate the new list items with the existing list in the list_column of the specified row(s) in the list_table.