Now there are
The create table tmp_dept (dept varchar2 (10), id varchar2 (5));
The begin
Insert into tmp_dept values (' dept1 ', '1');
Insert into tmp_dept values (' dept1 ', '2');
Insert into tmp_dept values (' dept2 ', '1');
Insert into tmp_dept values (' dept2 ', '2');
Insert into tmp_dept values (' dept2 ', '3');
Insert into tmp_dept values (' dept3 ', '1');
end;
No index, how to optimize the code below, or have a better deal, tmp_dept actual table data is larger than 200000
The select a. d. ept, Anderson d, Anderson d | | '/' | | b.i d
The from tmp_dept a, tmp_dept b
Where a. d. ept=b.d ept and Anderson d<> B.i d;
CodePudding user response:
Are you wantDept1 1/2
Dept2 1/2/3
Dept3 1
Or
Dept1 1/2
2/1 dept1
Dept2 1/2
A third dept2
2/1 dept2
Two-thirds dept2
3/1 dept2
Dept2 3/2
CodePudding user response: