Re: SQL question

From: joachim Carlsson <IKEA-joachim.carlsson_at_neurope.ikea.com>
Date: 1998/03/04
Message-ID: <6djn1c$ejk$1_at_mailgate.ikea.com>#1/1


You could do like this

this is assuming you have created a sequence with the name id. And that f1 is a datefield.

You can not use rownum since oracle only knows the first row. select * from t1 where rownum =1; -> OK select * from t1 where rownum =2; No rows selected. even if you know that there are data.

A how it would look with id = 1 and 2.

select d1.f1 - d2.f1 from date_table d1, date_table d2 where d1.id = 1
and d2.id = 2;

Regards
/Joachim

Marco Nedermeijer wrote in message <6dh4h4$8uh$1_at_news.NL.net>...
>I'm trying to create a sql-statement to do the following:
>
>i want to substract a date-field from a date-field of a previous record.
 my
>guess is that i need to use ROWNUM for this.
>
>Can someone help me to create this statement ?
>
>Thanks,
>
>Marco Nedermeijer
>m.n.nedermeijer_at_rtd.nl
>
>
>
Received on Wed Mar 04 1998 - 00:00:00 CET

Original text of this message