CodePudding user response:
Said the table structure, and your expected results, use excel to draw once, look more clearly;CodePudding user response:
Use regexp_substr () comma-separated list into multiple lines, the formation of the result set after the ext, again with emp federated query result set, regexp_substr () to baidu check about usageCodePudding user response:
Select * from emp p, ext t where t.u serId like '%' | | p.e mpCde | | '%'CodePudding user response:
The create table ext (userid varchar2 (32), worktype varchar2 (32));The create table emp (empcde varchar2 (32), workername varchar2 (32));
Insert into ext (userid, worktype) values (' 001002 ', '1');
commit;
Insert into ext (userid, worktype) values (' 001 ', '2');
commit;
Insert into emp (empcde workername) values (' 001 ', 'zhang');
commit;
Insert into emp (empcde workername) values (' 002 ', 'bill');
commit;
/*
This approach first won't appear the following situation
Employees a 001 employees b 1001 a and b duplicate
*/
Select * from ext a, emp b where instr (a.u serid, b.e mpcde) & gt;=1
/* you say this kind of question one can have multiple employees work can also be composed of multiple employees do
The best three tables to handle
A staff table a worksheet with a relational table can better handle the many-to-many relationship */
CodePudding user response:
Positive solution to second floor