Find and Replace MySQL column with substring


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

Example: There is a table, 'user', with a column, 'clear', containing values such as:

`clear
--------
\'animal\'
\'pass'\
`

and we would like to retrieve 'animal' and 'pass' ( without the pre & post \' )


Copy this code and paste it in your HTML
  1. TRIM( BOTH '\\\'' FROM clear )
  2. SUBSTRING( clear, 1, 1 ) = '\\'
  3.  
  4. SET clear = TRIM( BOTH '\\\'' FROM clear )
  5. SUBSTRING( clear, 1, 1 ) = '\\'

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.