explode in mysql
Posted: Fri Jan 25, 2008 1:04 am
I have field values in the form,
11-0010
11-2001
How to get the first characters before - character.
at present i am using,
SELECT * FROM table_name WHERE LEFT(field, 2) =$exploded_val[1];
this works fine. But it works only if the number of characters are 2 (that is 11 in the example ). Is there any regular expression function in mysql where i can get all the characters before the (-) character?
11-0010
11-2001
How to get the first characters before - character.
at present i am using,
SELECT * FROM table_name WHERE LEFT(field, 2) =$exploded_val[1];
this works fine. But it works only if the number of characters are 2 (that is 11 in the example ). Is there any regular expression function in mysql where i can get all the characters before the (-) character?