Perhaps it will be better if you put an 'order by' in the select.
SELECT
(( select test1.date
from test test1
where test1.date > test.date order by date limit 1)
- test.date ) AS result from test order by date;
result
42
31
33
25
Re
That's a good one, but it has the disadvantage of
giving a null result row:
insert into test values ( '2004-12-22' ) ;
The SELECT from below gives
result
31
33
25
(null)
42
(5 rows)
Also, I am not sure about the order of values.
Anyway, Béatrice, thanks for your
Dear Christoph,
perhaps you could try something like this example.
Regards,
BÃatrice
The table:
--
# select * from test;
date
2005-02-02
2005-03-05
2005-04-07
2005-05-02
(4 rows)
The query
--
SELECT
(( select test1.date
from test test1