For example I got result using group_concat
Example result is:
SELECT GROUP_CONCAT(customerid) FROM customers;
output is:
121,123,60,24,56,78,45,67,143,etc
Based on customerid now I want to update some details in another table.
Don't use group_concat()
. Use a subquery or join
. Something like this:
update othertable
set col = value
where customerid in (select customerid from customers);
Another option is to do a JOIN between the tables rather than use a subquery:-
UPDATE fcl_bl a
INNER JOIN notes b
ON a.file_number = b.module_ref_id
AND b.module_id = 'file'
AND b.note_desc LIKE '%(Received SSL Master -> Yes to No)%'
SET a.received_master='Yes'
WHERE received_master='No'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.