Am wondering whether and how i can retrieve a portion of text data from the text field in MSQL DB. What SQL function can i use in my query statement.
Eg.I have a text field containing data that looks like below;
(firstname1,lastname1,23,,district1,state1,province1),(firstname2,lastname2,23,,district2,state2,province2),
(firstname3,lastname3,23,,district3,state3,province3),…etc
how would i select for example a piece of data starting from
“lastname1” to “)” the bracket closing the first set.
am trying to figure out how i can do this but still failing.
The thing is i don’t want to retrieve all the data in the text field…so am wondering whether the MySQL query statements can help…
though the regular expressions would be of great use in this case as i think, but i don’t know how to structure them, am a new Bi…please help me at-least on this case.
thanks in advance.
You can also do it directly in MYSQL. Something like this would work:
reference:
http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_substr
http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_instr