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: A little complicated SQL

Re: A little complicated SQL

From: Alan <alanshein_at_erols.com>
Date: Thu, 18 Jul 2002 12:37:34 -0400
Message-ID: <ah6qs3$qpn80$1@ID-114862.news.dfncis.de>


Dan,

You left out choice #4: "I don't know how to use PL/SQL because I didn't do my homework, and now I have this really important assignment due."

"Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message news:3D36DBF8.3003E08E_at_exesolutions.com...
> Alex Kizub wrote:
>
> > I want to improve perfomance of my application but database structure
> > is not good.
> >
> > Here is problemm:
> >
> > One SQL is:
> > select A,B from T1;
> >
> > for each row I have to create another query
> > select C from X1,X2 where X1.A=A and X2.B=B and X1.D=X2.D;
> >
> > X1.A can be absent, X2.B can be absent and relation X1.D=X2.D can be
> > absent.
> >
> > So I can have something or nothing.
> >
> > So right now I have rowset like this
> >
> > A B Query

C
>
> --------------------------------------------------------------------------



> > A1 B1 select C from X1,X2 where X1.A='A1' and
X2.B='B1' and
> > X1.D=X2.D C1
> > A2 B2 select C from X1,X2 where X1.A='A2' and
X2.B='B2' and
> > X1.D=X2.D nothing
> > A3 B3 select C from X1,X2 where X1.A='A3' and
X2.B='B3' and
> > X1.D=X2.D C3
> >
> > Can I create query which returns for me
> >
> > A B C
> > ------------------------------
> > A1 B1 C1
> > A2 B2 null
> > A3 B3 C3
> >
> > in one select statement?
> > And I can't use PL/SQL in our database :(
> >
> > Thanks is advance.
> >
> > Alex Kizub.
>
> Go to http://tahiti.oracle.com and search on the following criteria:
>
> 1. In-line views
> 2. Sub-queries
>
> I apologize in advance if my assumption is incorrect. But when you say
"can't use PL/SQL in our database" I read it
> as being one of the following:
>
> 1. The teacher of your class wants you to do this with SQL
> 2. The teacher of your class wants you to do this with SQL
> 3. The teacher of your class wants you to do this with SQL
>
> ... and I don't think it is proper for us to do your homework for you.
>
> Daniel Morgan
>
Received on Thu Jul 18 2002 - 11:37:34 CDT

Original text of this message

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