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

Home -> Community -> Usenet -> c.d.o.server -> sql question

sql question

From: Patrick S <burcht61_at_hotmail.com>
Date: Sun, 4 Oct 1998 10:30:07 +0200
Message-ID: <6v7bp3$8pq$1@trex.antw.online.be>


Hi,

i've got two tables :

table 1 : unique_identifier varchar2(10)

                field_1   varchar2(30)

table 2 : unique_identifier  (same as table 1)  varchar2(10)
               start_date   date
               amount number
               date_of_insertion date

table 2 contains detail information of table 1. Users can only insert lines, no updates or deletes are allowed.

In table 1 is only one record per unique identifier

Table 2 contains an undefined number of rows for a unique identifier. It is possible to have more rows for a start_date, and the date of insertion
(sysdate) is the date that determines the most recent insert

How do i write a view that gives me the most recent insert for a start_date
(not necessarily the highest start_date) for a unique_identifier

for example

2 lines on 01-jan-90
3 lines on 01-jan-91
5 lines on 01-jan-92
3 lines on 01-jan-93
2 lines on 01-jan-94

...

Can i with a VIEW find the last inserted line (most recent date of insertion) for start_date 01-jan-92 for a unique identifier ? I also need all the columns of both tables in the view !

Thanks
Patrick SOETENS
burcht61_at_hotmail.com Received on Sun Oct 04 1998 - 03:30:07 CDT

Original text of this message

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