code_junkie

SQL (MySQL): Match first letter of any word in a string?

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. SELECT * FROM `articles` WHERE `body` REGEXP '[[:<:]][acgj]'
  2.  
  3. SELECT
  4. StringCol
  5. FROM
  6. MyTable
  7. WHERE
  8. ' ' + StringCol LIKE '% ' + MyLetterParam + '%'
  9.  
  10. '[acgj]'
  11.  
  12. WHERE
  13. ' ' + StringCol LIKE '%['+' '+CHAR(9)+CHAR(10)+CHAR(13)+CHAR(160)+'][acgj]%'
Add Comment
Please, Sign In to add comment