Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: A little complicated SQL
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:
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:
... and I don't think it is proper for us to do your homework for you.
Daniel Morgan Received on Thu Jul 18 2002 - 10:18:12 CDT