Reputation: 43
I am trying to select all the strings has word ABC1 in it. But getting wrong answer with LIKE query. Not sure how to get exact answer.
Below is the string format in a column:
"SomeString ABC1000 Other";
And I don't want to select any String which is in the format like
"itisABC1000 other other"
Upvotes: 0
Views: 37
Reputation: 43
Found answer with LIKE
select column
from table
where conditions like "% ABC1%" or conditions like "ABC1%";
Thank you!
Upvotes: 0
Reputation: 49403
with reular expression you can use REGEXP\_LIKE
select REGEXP_LIKE("SomeString ABC1000 Other",'ABC1')
REGEXP_LIKE("SomeString ABC1000 Other",'ABC1') |
---|
1 |
Your query would wlook like
SELECT yourcolmuns FROM your_table WHERE REGEXP_LIKE(yourlike_column,'ABC1')
select "SomeString ABC1000 Other" REGEXP 'ABC1'
"SomeString ABC1000 Other" REGEXP 'ABC1' |
---|
1 |
so the query would look like
SELECT yourcolmuns FROM your_table WHERE yourlike_column REGEXP 'ABC1'
Upvotes: 1