Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL question (sequence of dates into sequnce od date_from-date_to)

SQL question (sequence of dates into sequnce od date_from-date_to)

From: LokalST <stbest001_at_hotmail.com>
Date: Wed, 2 Oct 2002 15:15:39 +0200
Message-ID: <anerna$l8n$1@sunce.iskon.hr>


I'm on 8i WinXP
I have a table with some data of history change (id,object_id,type_id,date) and i want to write a query which should produce following columns: object_id,type_id,date_from,date_to

Sample data:
ID OBJECT_ID TYPE_ID DATE


1            1                        2                   19.07.2001
2            1                        5                   11.09.2001
3            1                        8                   18.09.2001
4            1                        51                 08.12.2001


I want to get folowing output:

OBJECT_ID TYPE_ID DATE_FROM DATE_TO


1                            2                    19.07.2001
11.09.2001
1                            5                    11.09.2001
18.09.2001
1                            8                    18.09.2001
08.12.2001
1                            51                  08.12.2001            NULL

I have basic query
SELECT t.object_id, t.type_id, t.date date_from FROM table_name t
ORDER BY t.date

but don't know how to get date_to.

Any idea?
Tnx ina advance Received on Wed Oct 02 2002 - 08:15:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US