/ Published in: MySQL
Expand |
Embed | Plain Text
SELECT IF(INSTR( `textfield`, ' ' ) > 0, SUBSTRING( `textfield` FROM 1 FOR (INSTR( `textfield`, ' ' ) -1 )), `textfield`) FROM `exampletable`;
You need to login to post a comment.
jpkunst on 02/25/10
1 person have marked this snippet as a favorite
SELECT IF(INSTR( `textfield`, ' ' ) > 0, SUBSTRING( `textfield` FROM 1 FOR (INSTR( `textfield`, ' ' ) -1 )), `textfield`) FROM `exampletable`;
You need to login to post a comment.