I have the following table:
CREATE TABLE TASK_2
(
ROLE_NAME VARCHAR2(50 BYTE),
MIN_CNT NUMBER,
MAX_CNT NUMBER
)
WITH THE FOLLOWING DATA:
INSERT INTO TASK_2 VALUES ( 'SE', 3, 5);
INSERT INTO TASK_2 VALUES ( 'SSE', 2, 6);
INSERT INTO TASK_2 VALUES ( 'MGR', 3, 5);
INSERT INTO TASK_2 VALUES ( 'SR_MGR', 1, 4);
THE DESIRED OUTPUT IS:
se there are 3;
se there are 4;
se there are 5;
sse there are 2;
sse there are 3;
sse there are 4;
sse there are 5;
sse there are 6;
mgr there are 3;
mgr there are 4;
mgr there are 5;
sr_mgr there are 1;
sr_mgr there are 2;
sr_mgr there are 3;
sr_mgr there are 4;
I have tried to use connect by and level.
SELECT role_name||' there are '||level
FROM task_2
CONNECT BY level < max_cnt
AND level > min_cnt
ORDER BY role_name;
AND THE OUTPUT IS:
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 1
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 4
mgr there are 4
se there are 4
se there are 4
se there are 4
se there are 1
se there are 4
se there are 4
se there are 4
se there are 4
se there are 4
sr_mgr there are 2
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 1
sr_mgr there are 3
sr_mgr there are 2
sr_mgr there are 3
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 3
sse there are 3
sse there are 4
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 4
sse there are 5
sse there are 3
sse there are 4
sse there are 5
sse there are 4
sse there are 5
sse there are 5
sse there are 5
sse there are 1
sse there are 5
sse there are 5
sse there are 3
sse there are 5
sse there are 4
sse there are 4
64 rows selected
So, i cannot see what and how exactly i should use. Because the level varies with role_name everytime. So can anyone tell me what i am missing?