Select the first word in a text field

/ Published in: MySQL
Save to your folder(s)

Copy this code and paste it in your HTML
  1. SELECT IF(INSTR( `textfield`, ' ' ) > 0, SUBSTRING( `textfield` FROM 1 FOR (INSTR( `textfield`, ' ' ) -1 )), `textfield`) FROM `exampletable`;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.