How to insert string data into table in column data of one row. I have string as :
data= pawan,123,jhs,abc@gmail
and i want to insert this
Assuming you have only four columns separated by comma in string:
INSERT INTO table_name VALUES(
REPLACE(SUBSTRING(SUBSTRING_INDEX(data_string, ',',1), LENGTH(SUBSTRING_INDEX(data_string, ',',0)) + 1), ',', ''),
REPLACE(SUBSTRING(SUBSTRING_INDEX(data_string, ',',2), LENGTH(SUBSTRING_INDEX(data_string, ',',1)) + 1), ',', ''),
REPLACE(SUBSTRING(SUBSTRING_INDEX(data_string, ',',3), LENGTH(SUBSTRING_INDEX(data_string, ',',2)) + 1), ',', ''),
REPLACE(SUBSTRING(SUBSTRING_INDEX(data_string, ',',4), LENGTH(SUBSTRING_INDEX(data_string, ',',3)) + 1), ',', '')