On Sat, Nov 30, 2002 at 02:45:44AM -0500, Joel Burton wrote:
> You can rewrite this w/EXISTS or with a multi-table join, and it
> should perform better:
>
> SELECT t2.*
> FROM trans AS t1,
> trans AS t2
> WHERE
> t1.chart_id = 10074
> AND t1.trans_id = t2.trans_id
> AND t2.amount >= 0
> AND t2.transdate BETWEEN '2002-07-01' AND '2002-09-30'
Doesn't that need a "distinct" to be equivalent to the exists query? If
there are two 10074 rows with the same trans_id, I think all rows with
that trans_id would be returned twice otherwise.
--
Scott Lamb