Subject | Re: Questions about SELECT DISTINCT * |
---|---|
Author | robert_difalco |
Post date | 2006-03-08T15:40:37Z |
Thanks Svein, then finally. Do you prefer these bottom two variations
over the original DISTINCT query?
over the original DISTINCT query?
> >
> > SELECT DISTINCT G.oid, G.name, G.description, G.type [, ...]
> > FROM Groupable G
> > JOIN Link ON G.oid = Link.childId
> > JOIN Path ON Link.parentId = Path.descendantId
> > WHERE (G.type = LEAF AND Path.ancestorId = 12345)
> >
>
> SELECT G.oid, G.name, G.description, G.type [, ...]
> FROM Groupable G
> WHERE G.type = LEAF AND
> G.oid IN (
> SELECT L.childId
> FROM Link L
> JOIN Path P ON L.parentId = P.descendantId
> WHERE P.ancestorId = 12345)
>
>
> SELECT G.oid, G.name, G.description, G.type [, ...]
> FROM Groupable G
> WHERE G.type = LEAF AND
> EXISTS(SELECT *
> FROM Link L
> JOIN Path P ON L.parentId = P.descendantId
> WHERE P.ancestorId = 12345
> AND G.oid = L.childId)
>