It’s my table rows:
++ id ---- text ++++++++++++++
-- 1 ---- '90','80,'50' -----
-- 2 ---- '30','2','1_2' --
-- 3 ---- '10_2','5_3' -----
as you see, text contains 2 types of numbers, one doesn’t have underscore, and the other does.
I want to select rows which have at least one number without underscore (type 1). Something like this: (result-set)
++ id ---- text ++++++++++++++
-- 1 ---- '90','80,'50' -----
-- 2 ---- '30','2','1_2' --
(3 is ignored)
How to do that? (I think it’s possible with NOT LIKE, but I don’t know how to write)
The below query counts the number of commas in the strings, number of distinct numbers can be calculated as 1 more than the number of commas as the numbers are separated by commas, number of underscores in the string:
The above query gives the following results:
Now using the logic of above query, following query can be used to get the desired result:
i.e. it returns the rows where atleast one number exists without the underscore.