Subject Re: [ib-support] Is these SQL statement result equal ?
Author Svein Erling Tysvaer
No, they are not. First, the second select will return all fields of both
pokladna and sys$rep and if you changed to 'select pokladna.*' it could
return duplicates if there were more than one match in sys$rep. What I
suspect you are looking for is

select *
from pokladna a
where exists(select 1 from sys$rep b where b.record_id=a.jedin
and b.tabulka='POKLADNA' and b.ZMENA<>'D'
and b.JEDIN>40000)

which should be equal to 1. except probably being considerably faster.

HTH,
Set

At 14:55 20.09.2002 +0200, you wrote:
>Hello ib-support@yahoogroups.com!
>
>1.
>
>SELECT * FROM POKLADNA
>WHERE JEDIN IN (SELECT RECORD_ID FROM SYS$REP
> WHERE TABULKA='POKLADNA' AND
> ZMENA<>'D' AND
> JEDIN>40000
>);
>
>
>2.
>
>select *
>from pokladna a
>join sys$rep b on b.record_id=a.jedin
>and b.tabulka='POKLADNA' and b.ZMENA<>'D'
>and b.JEDIN>40000;
>
>So ?