The following are three tables:
CT table
CTID CTNAME
11 CT1
12 CT2
13 tc3,
14 CT4
CG table
CGID CGNAME
21 CG1
22 CG2
23 CG3
24 CG4
25 CG5
CTCG table
CTID CGID
November 21
11 22
November 23
12 21
12 and 24
14 25
Want to get query:
CTNAME CGNAME
CT1 CG1 CG2, CG3
CT2 CG1, CG4
Tc3,
CT4 CG5
Excuse me, how to write SQL statements:
http://sqlfiddle.com/#! 4/b36688/125
Seek help from god;
CodePudding user response:
The building Lord baidu listagg under the function, is to solve your problem,
CodePudding user response: