Database is MySQL 5.6
CREATE TABLE set_t
(
set_r SET ('a', 'b', 'c')
);
INSERT INTO set_t (set_r) VALUES ('a,b,c'), ('a,b');
In my case i know only 'a' and 'b'.
For example, need to select row where set_r is "a,b,c".
Value 'c' is unknown, cant use it in query.
Values order is unknown also. They are may be set_r SET ('c', 'b', 'a') or else.
How to select rows, which contains unknown values?
You can use
find_in_set()to check for individual values. See SET documentation hereThis gives you
See this db<>fiddle
If you don't want the second row, you can add
and not like 'a,b'.