Make SELECT return only a snippet of the string

Asked

Viewed 48 times

-1

I need to make a query that only brings an excerpt of the string. I thought about using the SUBSTR() function but could not. Ex: column being something like [abcd efg hig; efg hig abcd; jkl juh hig] and I want to bring in the query only the amount of lines with "hig".

  • Do you want to filter your query with a Where? Here’s an example of what you tried to do?

  • [Edit] posting with a [mcve] and a brief example of expected data and results can help a lot.

  • Yes, I want to filter with a Where. But I need the query to bring the amount of lines with a certain substring. I don’t know is confused yet

1 answer

-2


If I understand your question correctly:

SELECT COUNT(*) FROM sua_tabela WHERE seu_campo LIKE '%hig%';
  • I thought about it, but I didn’t really understand what he wants... But I think you need the % in this like.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.