Subject | Re: Differents results using EXISTS |
---|---|
Author | Paul R. Gardner |
Post date | 2008-03-25T22:14:06Z |
I know he has his answer and this is effectively a closed thread,
however I have a related question about it. For these exists clauses,
is there a preferred method?
1. where exists (select * from some_table where some_where_clause)
2. where exists (select somefield from some_table where
some_where_clause)
3. where exists (select 1 from some_table where some_where_clause)
4. where exists (select first 1 1 from some_table where
some_where_clause)
#4 should return '1', and only 1 time (first 1).
I've always used #4 so that the exists subquery only returns one record
and then stops. I don't know if the others return all records in the
exists query or not.
[Non-text portions of this message have been removed]
however I have a related question about it. For these exists clauses,
is there a preferred method?
1. where exists (select * from some_table where some_where_clause)
2. where exists (select somefield from some_table where
some_where_clause)
3. where exists (select 1 from some_table where some_where_clause)
4. where exists (select first 1 1 from some_table where
some_where_clause)
#4 should return '1', and only 1 time (first 1).
I've always used #4 so that the exists subquery only returns one record
and then stops. I don't know if the others return all records in the
exists query or not.
[Non-text portions of this message have been removed]