![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, MyTable has missing records: id_group id_column ------------------------- 1 1 1 2 1 3 1 5 1 9 2 1 2 2 2 4 2 6 As you see, it could be missed record 4,6,7 and 8 of group 1 and record 3 and 5 of group 2. That's is an example. I need to show all sequential records, incluing missing ones, like this: Id_group Id_column ------------------------------------------------- 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 1 2 2 2 3 2 4 2 5 2 6 I try this query: Select G.id_group, C.rownum id_column from (select distinct id_group from MyTable) G cross join (SELECT rownum FROM dual CONNECT BY LEVEL <= (select max(id_column) from MyTable)) C but it shows record 7, 8 and 9 as members of group 2. Could somebody help me, please? Thanks. |
#3
| |||
| |||
|
|
Hello, MyTable has missing records: id_group *id_column ------------------------- 1 * * *1 1 * * *2 1 * * *3 1 * * *5 1 * * *9 2 * * *1 2 * * *2 2 * * *4 2 * * *6 As you see, it could be missed record 4,6,7 and 8 of group 1 and record 3 and 5 of group 2. That's is an example. I need to show all sequential records, incluing missing ones, like this: Id_group * * *Id_column ------------------------------------------------- 1 * * * * * * * * *1 1 * * * * * * * * *2 1 * * * * * * * * *3 1 * * * * * * * * *4 1 * * * * * * * * *5 1 * * * * * * * * *6 1 * * * * * * * * *7 1 * * * * * * * * *8 1 * * * * * * * * *9 2 * * * * * * * * *1 2 * * * * * * * * *2 2 * * * * * * * * *3 2 * * * * * * * * *4 2 * * * * * * * * *5 2 * * * * * * * * *6 I try this query: Select G.id_group, C.rownum id_column from (select distinct id_group from MyTable) G cross join (SELECT rownum FROM dual CONNECT BY LEVEL <= (select max(id_column) from MyTable)) C but it shows record 7, 8 and 9 as members of group 2. Could somebody help me, please? Thanks. |
#4
| |||
| |||
|
|
Hello, MyTable has missing records: I need to show all sequential records, incluing missing ones, like this: Could somebody help me, please? Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |