Subject | Re: Questions about SELECT DISTINCT * |
---|---|
Author | robert_difalco |
Post date | 2006-03-02T19:03:26Z |
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær
<svein.erling.tysvaer@...> wrote:
table that creates a tree structure. Believe it or not, the query
above performs more efficiently that without the subquery because of
the DISTINCT.
R.
<svein.erling.tysvaer@...> wrote:
> >I think you are missing the JOINS. Think of a JOIN say on a Links
> > SELECT * FROM Table A WHERE A.uid IN
> > SELECT DISTINCT uid FROM Table [JOINS][WHERE];
> >
>
> Yup, my first thought was "What a lousy idea, this won't even get him
> the right result"! If RowA and RowB have the same UID, then both will
> match the subselect and hence be returned. I cannot even think of a
> case where the DISTINCT word of 'IN (SELECT DISTINCT...)' makes any
> difference.
table that creates a tree structure. Believe it or not, the query
above performs more efficiently that without the subquery because of
the DISTINCT.
R.