Skip to content

Instantly share code, notes, and snippets.

@gjergjsheldija
Created October 4, 2012 09:28
Show Gist options
  • Save gjergjsheldija/3832507 to your computer and use it in GitHub Desktop.
Save gjergjsheldija/3832507 to your computer and use it in GitHub Desktop.
find number of occurrences in string
SELECT `order_nr` ,
(LENGTH( history ) - LENGTH( REPLACE( history, 'Received', '' ) )) / LENGTH( 'Received' ) AS occurrences
FROM care_pharma_orderlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment