darkk select time node_id from time node_id ------ --------- rows dark

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
darkk=> select time, node_id from t ;
time | node_id
------+---------
1 | 1
2 | 1
3 | 2
4 | 2
5 | 1
6 | 1
7 | 3
8 | 1
(8 rows)
darkk=> SELECT node_id, time AS "from" FROM t AS now WHERE NOT EXISTS (SELECT 1 FROM t AS past WHERE past.time = now.time - 1 AND past.node_id = now.node_id) ;
node_id | from
---------+------
1 | 1
2 | 3
1 | 5
3 | 7
1 | 8
(5 rows)
darkk=> select VERSION();
version
-----------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.15 on i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.2)
(1 row)