mardi 4 août 2015

How to get all records without duplicate

Hello everyone I'm trying to get all records without duplicate.

Here my sample database records.

   (`id`, `productName`, `description`)
   -----------------------------------------------
   (1, 'OpenIDM', 'Platform for building enterprise provisioning solutions'),
   (2, 'OpenAM', 'Full-featured access management'),
   (3, 'OpenDJ', 'Robust LDAP server for Java'),
   (4, 'OpenDJ', 'Robust LDAP server for Java')  !!This line should not appear after SQL result

What I want to get with SQL

   (`id`, `productName`, `description`)
   -----------------------------------------------
   (1, 'OpenIDM', 'Platform for building enterprise provisioning solutions'),
   (2, 'OpenAM', 'Full-featured access management'),
   (3, 'OpenDJ', 'Robust LDAP server for Java'),

Here is my SQL snippet for this subject.

select productName 
from ForgeRock
WHERE productName in (select productName from ForgeRock group by productName having count(*)>1)

http://ift.tt/1M2selS

How can I get all elements without duplicates ? Thanks for helpings.

Aucun commentaire:

Enregistrer un commentaire