DISTINCT Keyword In CompareSetPredicate?

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 16-May-2005 20:59:17   

Quick question:

Any way to get the DISTINCT keyword into the subquery of a compare set predicate? Do I need to use group by instead (should be the same execution plan)?

Thanks,

Phil

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39872
Joined: 17-Aug-2003
# Posted on: 17-May-2005 11:55:46   

psandler wrote:

Quick question:

Any way to get the DISTINCT keyword into the subquery of a compare set predicate? Do I need to use group by instead (should be the same execution plan)?

DISTINCT in a subquery isn't really needed, as you compare to a set, so if that set contains duplicates, that's not a problem. DISTINCT often is slower in that situation. Could you give an example where you do need it?

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 17-May-2005 15:47:49   

Otis wrote:

psandler wrote:

Quick question:

Any way to get the DISTINCT keyword into the subquery of a compare set predicate? Do I need to use group by instead (should be the same execution plan)?

DISTINCT in a subquery isn't really needed, as you compare to a set, so if that set contains duplicates, that's not a problem. DISTINCT often is slower in that situation. Could you give an example where you do need it?

No example. You're right: it would actually be less efficient. simple_smile