Subject Re: Show individual duplicates
Author ruan_h
--- In firebird-support@yahoogroups.com, "Serge Fonville"
<serge.fonville@...> wrote:
>
> Hi,
>
> Thanks for the repsonse
>
> Unfortunately, this is just a simple join finding the fields together.
> This way the textual skillevel for each individual is listed
> What I need is that only the duplicates are shown individually
>
> Serge
>
> On Wed, Jul 30, 2008 at 1:15 PM, Lester Caine <lester@...> wrote:
>
> > serge.fonville wrote:
> > > Hi,
> > >
> > > I have two tables:
> > > persons:
> > > ID,name,skillLevelID
> > > 1,John,4
> > > 2,George,4
> > > 3,Caroline,2
> > > 4,Harold,3
> > > 5,Arnold,2
> > >
> > >
> > > SkillLevel:
> > > ID,Name
> > > 1,The Best
> > > 2,Good
> > > 3,Sufficent
> > > 4,Reasonable
> > > 5,Not that good
> > > 6,Bad
> > > 7,Awful
> > >
> > > The output should be
> > > Skilllevels:
> > > Person,level
> > > John,reasonable
> > > George,reasonable
> > > Caroline,Good
> > > Arnold,Good
> >
> > Simple
> >
> > SELECT a.NAME, b.NAME
> > FROM PERSONS a
> > JOIN SKILLLEVEL b ON a.SKILLLEVELID = b.ID
> >
> > --
> > Lester Caine - G8HFL
> > -----------------------------
> > Contact - http://lsces.co.uk/lsces/wiki/?page=contact
> > L.S.Caine Electronic Services - http://lsces.co.uk
> > EnquirySolve - http://enquirysolve.com/
> > Model Engineers Digital Workshop - http://medw.co.uk//
> > Firebird - http://www.firebirdsql.org/index.php
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
Maybe try this:

select
pl.id,
pl.name,
skill.skilldesc
from people pl
inner join skill on skill.skillid = pl.skillid
where
exists (
select 1
from people pl1
where pl1.skillid = pl.skillid and
pl1.id <> pl.id
)