Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cool way to eliminate duplicate column values?
Message
From
07/04/2001 10:26:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
06/04/2001 22:34:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00493142
Message ID:
00493202
Views:
18
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform