github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_string_findinset.result (about) 1 SELECT FIND_IN_SET('b','a,b,c,d'); 2 FIND_IN_SET('b','a,b,c,d') 3 2 4 select bin(concat_ws(" ",find_in_set('b','a,b,c,d'))); 5 bin(concat_ws(" ",find_in_set('b','a,b,c,d'))) 6 10 7 select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd"); 8 find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd") 9 2 3 3 2 10 select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd"); 11 find_in_set("d","a,b,c") find_in_set("dd","a,bbb,d") find_in_set("bb","a,bbb,dd") 12 0 0 0 13 select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); 14 find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c") 15 0 4 1 16 select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); 17 find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc") 18 1 0 0 19 select find_in_set('1','3,1,'); 20 find_in_set('1','3,1,') 21 2 22 select find_in_set('你好', "你好,我好,大家好"); 23 find_in_set('你好', "你好,我好,大家好") 24 1 25 select find_in_set(Null, null); 26 find_in_set(Null, null) 27 null 28 select find_in_set('1', null); 29 find_in_set('1', null) 30 null 31 select find_in_set(null,"a,b,c,d"); 32 find_in_set(null,"a,b,c,d") 33 null 34 select find_in_set('a,', 'a,b,c,d'); 35 find_in_set('a,', 'a,b,c,d') 36 0 37 select find_in_set("*#(()@*31()@*)#)_", "qwkrjqjiofj,*#(()@*31()@*)#)_,f023jf09j2"); 38 find_in_set("*#(()@*31()@*)#)_", "qwkrjqjiofj,*#(()@*31()@*)#)_,f023jf09j2") 39 2 40 select find_in_set('a', 'abcd'); 41 find_in_set('a', 'abcd') 42 0 43 create table t1 (a varchar(255)); 44 insert into t1 values('1'),('-1'),('0'),("abc"); 45 select * from t1 where find_in_set('-1', a); 46 a 47 -1 48 drop table t1; 49 CREATE TABLE t1 ( 50 access_id int NOT NULL default 0, 51 name varchar(20) default NULL, 52 `rank` int NOT NULL default 0, 53 PRIMARY KEY idx (access_id) 54 ); 55 CREATE TABLE t2 ( 56 faq_group_id int NOT NULL default 0, 57 faq_id int NOT NULL default 0, 58 access_id int default NULL, 59 PRIMARY KEY idx1 (faq_id) 60 ); 61 INSERT INTO t1 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4); 62 INSERT INTO t2 VALUES (261,265,1),(490,494,1); 63 SELECT t2.faq_id FROM t1 INNER JOIN t2 ON (t1.access_id = t2.access_id) LEFT JOIN t2 t ON (t.faq_group_id = t2.faq_group_id AND find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4')) WHERE t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265); 64 faq_id 65 265 66 drop table t1; 67 drop table t2; 68 CREATE TABLE t1(a char(255), b int); 69 INSERT INTO t1 select 'a,b,c,d', FIND_IN_SET('b','a,b,c,d'); 70 INSERT INTO t1 select "a,bbb,dd", find_in_set("dd","a,bbb,dd"); 71 INSERT INTO t1 select "a,b,c", find_in_set("c","a,b,c"); 72 SELECT distinct find_in_set('a', a) FROM t1; 73 find_in_set('a', a) 74 1 75 drop table t1; 76 CREATE TABLE t1 (a varchar(10)); 77 INSERT INTO t1 VALUES ('abc'), ('xyz'); 78 SELECT a, CONCAT_WS(",",a,' ',a) AS c FROM t1 79 HAVING find_in_set('a', c) =0; 80 SQL syntax error: column "t1.a" must appear in the GROUP BY clause or be used in an aggregate function 81 DROP TABLE t1; 82 select find_in_set("","a,b,c")*find_in_set("","a,b,c,")-find_in_set("bb","a,bbb,dd"); 83 find_in_set("","a,b,c")*find_in_set("","a,b,c,")-find_in_set("bb","a,bbb,dd") 84 0