sql - Add substring_index upto 3 and add comma - MySQL Query -
i have query select 1st 3 words field , add column in table:
update `site`,`clients` set `site`.`words` = substring_index(`clients`.`name` , ' ', 3) `clients`.`client_id`=`site`.`client_id`;
1st 3 words added successfully, need make them comma separated.
how can ?
thanks help.
a simple replace
fix it.
update `site`,`clients` set `site`.`words` = replace(substring_index(`clients`.`name` , ' ', 3)," ",",") `clients`.`client_id`=`site`.`client_id`;
Comments
Post a Comment