Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find duplicate ID by last 3 digits and address
Message
From
25/09/2010 07:46:28
 
 
To
24/09/2010 21:02:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01482677
Message ID:
01482699
Views:
64
>Hi all,
>
>I have a single table that I would like to find a single record for each same name, same first name, same birthday, different address that are created those persons ID:
>
>For example :
>
>mytable contains only an ID and city :
>
>Name, First, Birthday, address = ID and city
>
>Joe Doe 19601231 mycity = JDOE19601231001 mycity
>Joe Doe 19601231 yourcity = JDOE19601231002 yourcity
>Joe Doe 19601231 hiscity = JDOE19601231003 hiscity
>
>Joe Doe 19651231 hercity = JDOE19651231002 hercity
>Joe Doe 19651231 sexcity = JDOE19651231001 sexcity
>
>Jay Doe 19601231 joecity = JDOE19601231001 joecity
>Jay Doe 19601231 jaycity = JDOE19601231002 jaycity
>Jay Doe 19601231 ourcity = JDOE19601231003 ourcity
>
>
>Joe Doe 19651231 fullcity = JDOE19651231001 fullcity
>Joe Doe 19651231 lastcity = JDOE19651231002 lastcity
>Joe Doe 19651231 firstcity = JDOE19651231004 firstcity
>
>I could have a hundred records to sort out by the last 3 digits of their id started from 001,002,003,004,005 .....100 and different addresses that separated each id.
>
>I really appreciated that someone could help me with the SQL command to do this.

I'm not exactly sure what you're looking for, but if you want to find one record for each value of the first 12 characters of ID, you can get a list of the unique values with:
SELECT DISTINCT LEFT(ID, 12) ;
  FROM MyTable ;
  INTO CURSOR csrUniqueID
You can then use that list to filter the original table in some way.

If you need more help, tell us exactly what the result you want is, and whether you're trying to change the original table or create something new.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform