Jump to content

sql help


smart190

Recommended Posts

table value (col1, col2, col3)values ('text1', 'text2,text3', 'text4') i need to get text2 and text3 to diffrent rowstext1 text2 text4text1 text3 text4I try'd to use some split funtion ('text2,text3', ',') and result gives text2text3how is possible to relate this split and get to on table?

Link to comment
Share on other sites

I'm not sure I understand the problem completely, but if you want to separate "text2,text3" into two vars, you could use explode() and separate it along the comma:$foo= explode(',', "text2,text3");This will give you an array with "text2" in $foo[0] and "text3" in $foo[1]. I'm assuming there aren't any other commas in "text2" and "text3"...if there are you will probably need to use another method.

table value (col1, col2, col3)values ('text1', 'text2,text3', 'text4') i need to get text2 and text3 to diffrent rowstext1 text2 text4text1 text3 text4I try'd to use some split funtion ('text2,text3', ',') and result gives text2text3how is possible to relate this split and get to on table?
Link to comment
Share on other sites

I'm not sure I understand the problem completely, but if you want to separate "text2,text3" into two vars, you could use explode() and separate it along the comma:$foo= explode(',', "text2,text3");This will give you an array with "text2" in $foo[0] and "text3" in $foo[1]. I'm assuming there aren't any other commas in "text2" and "text3"...if there are you will probably need to use another method.
yes I have allready function that splits but i don't now how to clasp to on sql procedure.procedure is something like this:create table (col1, col2, col2)insert into select col1, col2, col3form tabelupdate tabelset col2 = split funciton ('text2,text3', ',')but that not work because result is two rows but in main table is one
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...