Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to construct a query on this
Message
 
 
À
08/05/2008 01:05:26
Jeffrey Ang
JGA Software Inc.
Davao, Philippines
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01315788
Message ID:
01315802
Vues:
18
SELECT * FROM mytable mt1 WHERE NOT EXISTS  
          ( SELECT 1 FROM mytable WHERE value = mt1.value AND id < mt1.id )
- or
SELECT * FROM mytable mt1 WHERE id =  
          ( SELECT MIN(id) FROM mytable WHERE value = mt1.value )
>To all sql guru's pls. help on this query. I'd like to eliminate those duplicate values. I want to remain only those 1st occurences.
>
>ID Value
>
>1  001
>2  001
>3  001
>4  002
>5  002
>6  003
>7  004
>8  004
>9  004
>10 004
>
>The result would be like this
>
>ID Value
>
>1  001
>4  002
>6  003
>7  004
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform