Home > database >  SQL string for help
SQL string for help

Time:12-18

The CREATE TABLE TestA (Names VARCHAR (20), the Value VARCHAR (20))
The CREATE TABLE TestB (Names VARCHAR (20))

INSERT INTO TestA VALUES (A, B, C ', '22,44,66')
INSERT INTO TestA VALUES (A, B, C, D, '22,44,66,88')

INSERT INTO TestB VALUES (' B, C, A ')
INSERT INTO TestB VALUES (' D, B, C, A ')

How to judge Names fields ABC=BCA=CAB, ABCD=ABDC=BACD etc

CodePudding user response:

String, sorting, joining together again, after processing can be used directly group by name having count (1) & gt;=2 determine whether repeated

CodePudding user response:

Good idea, I just want to in the string, how to compare, unexpectedly sorted in joining together, there is no other way?

CodePudding user response:

reference 1/f, party party of rabbit replies:
string, sorting, joining together again, after processing can be used directly group by name having count (1) & gt;=2 determine whether repeated

Table TestA two columns will split the desired result is

A, B, C A 22
A, B, C B 44
A, B, C, 66 C
  • Related