|
-
Replace data in child table
I need help with the sql statement to do the following - 2 tables are linked-contacttbl & addrtbl. The contact table contains a unique uid yet duplicate names. The addr table contains the contact-uid as foreign key. I know how to delete duplicate records. What I need help with is - I need to replace the contact-uid in the addr table with just one contact-uid after all the duplicates are deleted.
Before-
contacttbl addrtbl
contact-uid name addr-uid contact-uid addr
1 john smith 1 1 a
2 john smith 2 2 b
3 john smith 3 3 c
4 dave blue 4 4 x
After
contacttbl addrtbl
contact-uid name addr-uid contact-uid addr
1 john smith 1 1 a
4 dave blue 2 1 b
3 1 c
4 4 x
I appreciate any help. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|