Subject Re: [ib-support] Is these SQL statement result equal ?
Author Andrew Guts
Roland Turcan 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 ?
>
>

(1) selects all columns from first table, but (2) selects all columns
from both. (2) may cause column name conflict.
Both statements are targeted to return the same rows, but first may fail
if subselect returns huge recordset. Join (in 2) is more effective.