MySQL Forums
Forum List  »  Newbie

Split string with single quote for each item
Posted by: Ninad Shinde
Date: February 13, 2023 01:53AM

I have simple query...

Set @SQl1 = '415,417,418,419,420,416';
Set @SQl2 = REPLACE(@SQl1,","," ',' ");
Select @SQl1, @SQl2;

The result is -
@SQl1 = '415,417,418,419,420,416'
@SQl2 = '415 '','' 417 '','' 418 '','' 419 '','' 420 '','' 416'

But i Want result like this -
@SQL2 = '415','417','418','419','420','416'

Tried many functions like replace, Substring, json_unquote, quote.... but no success...

Anybody can help?

Options: ReplyQuote


Subject
Written By
Posted
Split string with single quote for each item
February 13, 2023 01:53AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.