SQL retrieves duplicate even if distinct specified -


im trying retrieve distinct competence_id rows table has duplicate ones based on:

select distinct competences.competence_id, skillmgt.*  competences join skillmgt  on competences.competence_id=skillmgt.cid skillmgt.eid=121 , datename(yyyy,skillmgt.timestamp)='2013' 

but gets competence_ids duplicates.

you need group by.

select competences.competence_id, skillmgt.*  competences join skillmgt  on competences.competence_id=skillmgt.cid group competences.competence_id 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -