Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cool way to eliminate duplicate column values?
Message
De
07/04/2001 10:26:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/04/2001 22:34:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00493142
Message ID:
00493202
Vues:
19
>OK. I give up. I gotta believe there is a cool way to use SQL queries to insure that no two rows of a result set have identical values in a particular field.
>
>Sure, I can order the table by the field of interest then run a little loop to find and eliminate multiple records with identical values for the field.
>
>And yes, I know how to use SELECT-SQL DISTINCT to eliminate rows where ALL fields are identical to a row already in the result set!
>
>But I'll be damned if I can figure out an ELEGANT way to do what I want(eliminate rows with just one identical field), and I just gotta believe that this is such a common task (find initial work order for each part we make....or....make sure the value is unique BEFORE I try making it a primary key....etc.)
>
>Surely one of you mavins out there has a spiffy solution!?

Would this work ?
select distinct myField, recno() as rcno ;
 from myTable into cursor crsUnique nofilter
select * from mytable where recno() in (select rcno from crsUnique)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform