mysql query add single quote in query -


need suggestions how convert below query result in to: use philips,led,and tv in single quote.

insert company_rawdata_split select 2,splits (select null splits union select 'philips' union select 'led' union select 'tv') splits not null;

query:

select concat     ('insert company_rawdata_split select ',id,',splits (select null splits union select ',     replace(complaint_against  ,' ',  ' union select '),') splits not null;'     ) prodcatqueries company_rawdata_new 

result

insert company_rawdata_split select 2,splits (select null splits union select philips union select led union select tv) splits not null; 

the following should accomplish you're attempting. it's matter of getting clever placement of escaped single quotes \'

select concat ('insert company_rawdata_split select ',id,',splits (select null splits union select \'', replace(complaint_against ,' ', '\' union select \''),'\') splits not null;' ) prodcatqueries company_rawdata_new


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -