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: Two SQL questions.

Re: Two SQL questions.

From: <drippel_at_perspect.com>
Date: 1997/09/18
Message-ID: <34216800.18204827@news.erols.com>#1/1

How about this...
select t1.a, t1.b, t2.c, t3.d
from t1, t2, t3

where   t1.a = t2.a
and     t1.a = t3.a
and     t2.c = ( select min( c ) from t2 )
and     t3.d = ( select min( d ) from t3 )
union
select t1.a, t1.b, t2.c, ' '
from t1, t2
where   t1.a <> t2.a
and     t2.c = ( select max( c ) from t2 )
and     t1.a <> ( select max( a ) from t1 )
union
select t1.a, t1.b, ' ', t3.d
from t1, t3
where   t1.a <> t3.a
and     t3.d = ( select max( d ) from t3 )
and     t1.a = ( select max( a ) from t1 )

doesnt depend on the substring so arbitrary values will work.

On Thu, 18 Sep 1997 12:51:35 -0700, stephen <c6635500_at_comp.polyu.edu.hk> wrote:

>
>Hello all,
>
> I have two questions about SQL statements:
>
> 1)How to know the version of SQL*NET in SQL*PLUS? (i.e. by which
>SQL statement)
>
> 2)Assume three tables in Oracle.
>
> Table Attributes
> ----- ----------
> T1 A, B
> T2 A, C
> T3 A, D
>
> A B A C A D
> ----- ---- -----
> a1 b1 a1 c1 a1 d1
> a2 b2 a1 c2
> a3 b3 a1 d3
>
> I want the result is:
>
> row1: a1 b1 c1 d1
> row2: a2 b2 c2
> row3: a3 b3 d3
>
> How to do this by a single SQL statement?
>
>Thanks,
>Stephen
Received on Thu Sep 18 1997 - 00:00:00 CDT

Original text of this message

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