stupid SQL statement
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, sorry for silly question but is the below SQL statement correct ? select (select pl from artapo a where a.re=b.re and a.wo=b.wo) from artll b where b.re=36 and b.wo=1 and b.rmb="1995-11" and b.rmr="1995-11" and b.wsk_kor=0 I've found something like that in 4GL program and it worked (to my suprise) Best regards. B.Pankowski
Hi B.,
well: Yes, it is correct.
Your statement is equvalent to:
select a.pl
from artllb b, outer artapo a
where a.re=b.re and a.wo=b.wo
and b.re=36 and b.wo=1
and b.rmb="1995-11" and b.rmr="1995-11" and b.wsk_kor=0;
which (under "normal" situations) should outperform the original query.
Peter
B. Pankowski wrote:
>
> Hi,
> sorry for silly question but is the below SQL statement correct ?
>
> select (select pl from artapo a where a.re=b.re and a.wo=b.wo)
> from artll b
> where b.re=36 and b.wo=1 and b.rmb="1995-11" and b.rmr="1995-11" and
> b.wsk_kor=0
>
> I've found something like that in 4GL program and it worked (to my suprise)
>
> Best regards.
> B.Pankowski
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/ Mag. Peter Kolmhofer __ _ _____ _/
_/_/ Informix & DB2 DBA __ --/_|___\\______ _/
_/_/ Porsche Informatik (Austria) _ _ ( _ _ \\) _/
_/_/ A-5101 Bergheim, Handelszentrum 7 -(_)-------(_)- _/
_/_/ +43 662 4670-6258 fax: -6501 email:kop@porsche.co.at _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/