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 -> Re: How to get consecutive pairs from a table in SQL?

Re: How to get consecutive pairs from a table in SQL?

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Wed, 16 Nov 2005 22:19:51 +0100
Message-ID: <437ba278$0$8283$626a14ce@news.free.fr>

"dean" <deanbrown3d_at_yahoo.com> a écrit dans le message de news: 1132174815.519465.282530_at_o13g2000cwo.googlegroups.com...
|I have a train's route table as follows (for one train):
|
| LOCATION_I varchar2(6) not null
| ORDERnumber not null
|
| The table lists all the stations that the train goes through.
|
| Is there a simple way to get consecutive pairs of these locations, if
| they are ordered by ROUTE_ORDER_I? I've done some SUM OVER queries, so
| was wondering if there was anything similar.
|
| Thanks,
|
| Dean
|

Have a look at LAG function:
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions56a.htm#83619

Regards
Michel Cadot Received on Wed Nov 16 2005 - 15:19:51 CST

Original text of this message

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