I want to build a mysql query to search comma-separate string with in another comma-separate string.
For example : search string '1,3,5' from '1,2,3,4,5,6'
What will be the mysql query?
I want to build a mysql query to search comma-separate string with in another comma-separate string.
For example : search string '1,3,5' from '1,2,3,4,5,6'
What will be the mysql query?
It is going to depend on what type of result you want from the data.
For example: are you wanting it to be selected if the individual elements of the search string are in the data string
If you have a search string '1,3,5' from and llok for each element in '1,2,3,4,5,6' would be true for this search since 1,3,5 and elements in the data string. If this is what you want then you will have to separate out the individual elements and search the data for them. Sub set of this would also need to know if every element has to be present in the data string or if at least 50-60 percent are there.
Or are you looking for the comma separated search sting to exist intact in the data.
search string '1,3,5' from '1,2,3,4,5,6' would not be selected in the data string because 2 is between 1 and 3 in the data but searching for
'1,2,3' would select because the elements are present and in the same order.
Once you lock down all of the parameters and if you aere still puzzled the tell us better what you are looking for.
The sub-string will always be from the original string with different orders (comma separated)
Below are the few example.
Original String : 1,2,3,4,5,6
a. 1,2,4,6
b. 4,6,1
c. 2,3
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.