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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -