Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Help with sql-query
Hi,
I have rows like this (columns a b c):
1 20.06.2007 24.06.2007
2 21.06.2007 23.06.2007
and I need a SELECT-query that returns:
1 20.06.2007
1 21.06.2007
1 22.06.2007 1 23.06.2007 1 24.06.2007 2 21.06.2007 2 22.06.2007 2 23.06.2007
I managed to do this for rows 1 or 2 separately, but not all rows in the
same select. My query is:
CREATE TABLE MAIKKU (A NUMBER(1),B DATE,C DATE);
INSERT INTO MAIKKU VALUES (1, TRUNC(SYSDATE), TRUNC(SYSDATE+5));
INSERT INTO MAIKKU VALUES (2, TRUNC(SYSDATE+1), TRUNC(SYSDATE+2));
SELECT * FROM maikku;
SELECT a, b,c, b-1+ROWNUM FROM maikku WHERE a=1 CONNECT BY ROWNUM <= c-b+1;
Any ideas ?
Thanks in advance !
Maija-Leena Received on Thu Jun 21 2007 - 04:47:32 CDT