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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL Question

RE: SQL Question

From: <Jorma.Vuorio_at_nokia.com>
Date: Thu, 4 Jan 2001 10:32:31 +0200
Message-Id: <10731.125678@fatcity.com>


Ave !

Works if Your max seqno is 2:

select
 a.date, a.area_from || ' - ' || a.area_to ||   decode(b.area_to,null,' ',' - ' || b.area_to)

     from table a, table b where a.seqno = 1 and 
          b.seqno(+) = 2 and a.date = b.date(+);

Br.
Jorma

> -----Original Message-----
> From: ext Johan Locke_at_i-Commerce Services
> [mailto:Johan.Locke_at_za.didata.com]
> Sent: 04 January, 2001 9:11
> To: Multiple recipients of list ORACLE-L
> Subject: SQL Question
>
>
> Hi All
>
> Got the following table
> DATE SEQNO AREA_FROM AREA_TO
> ---- ----- --------- --------
> 20-JAN 1 LONDON NEW YORK
> 20-JAN 2 NEW YORK ATLANTA
> 21-JAN 1 LONDON PARIS
> 22-JAN 1 NAIROBI PARIS
> 22-JAN 2 PARIS NAIROBI
> 23-JAN 1 ATLANTA NEW YORK
>
>
> Now I need the following report based on the data:
> DATE AREAS
> ---- -----
> 20-JAN LONDON - NEW YORK - ATLANTA
> 21-JAN LONDON - PARIS
> 22-JAN NAIROBI - PARIS - NAIROBI
> 23-JAN ATLANTA - NEW YORK
>
> (1) Any Ideas on how to do this report without using Dynamic SQL
> (2) Is it possible to write a custom GROUP function in PL/SQL (i.e.,
> something that would do a concatenate instead of a sum)?
>
> Kind Regards
>
> Johan Locke
>

http://www.JohanLocke.co.za
Certified Oracle 8 & 8i DBA
Certified Oracle Developer

Dimension Data i-Commerce Internet Services Direct Line: +27 11 516 5343
mailto:Johan.Locke_at_za.didata.com
http://www.didata.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Johan Locke_at_i-Commerce Services
  INET: Johan.Locke_at_za.didata.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
Received on Thu Jan 04 2001 - 02:32:31 CST

Original text of this message

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