Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a Primary key.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00322044
Message ID:
00323506
Views:
24
>Ed,
>
>I should explain why I am trying do this SELECT statement. When I try to designate Custid+Upsino as the Primary key I get "Uniqueness of Index Violated", so I am trying to determine which records are NOT unique.
>

A primary key is for a specific table, and is unique within that table. If you have a partial key that points at the parent, that's a foreign key, not a primary key, and is usually a regular index, because there can be multiple children of a given parent's primary key.

If you take the resuylts of the query I gave you the first time, you can use the result of that to pull all the 'duplicated' records from the result of the query joined with query results. If the fields were F1, F2, F3 and F4 from the query (I'm having a rought mornging, so I don't remeber what they were), you'd get the records duplicating each other by saying:

SELECT OldTable.* FROM OldTable O, Query Q;
WHERE O.f1 = Q.F1 AND O.F2 = Q.F2 AND O.F3 = Q.F3 AND O.F4 = Q.F4 ;
INTO CURSOR MyDupRecs ;
ORDER BY O.F1,O.F2, O.F3, O.F4

MyDupRecs is a cursor of records in OldTable that have 'dup' keys grouped together.

IOW, take the first query results to find the key duplicate sets, and a second query that uses the result from the first to isolated just the possible dups.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform