SQL query to extract part of column -


i have query below, selects description table description contains 'legal:'

at moment extracts in description field. want extract 50 characters 'legal:' keyword on.

select description issues description '%legal:%' 

any appreciated.

mysql

select substring(substring_index(description, 'legal:', -1), 1, 50) issues description '%legal:%' 

see demo

sql server

select substring(description, charindex('legal:', description) + 6, charindex('legal:', description) + 56) issues description '%legal:%'   , charindex('legal:', description) > 0 

see demo


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -