By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

Comparing Two Tables and Deleting duplicate

P: 3
Hello

I have Two Tables ( Table A and Table B)

Table A has one field : email
Table B has three Fields : First name, Last name , email

I want to check if the email in Table B is found in Table A, And if it is , then I want to delete the row ( First name, Last name , email ) from Table B that has that email.

any help is really appreciated and thank you in advance!
Nov 11 '09 #1
Share this Question
Share on Google+
5 Replies


code green
Expert 100+
P: 1,726
A sub-query is probably the easiest to understand
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM tableA WHERE email IN (SELECT email FROM tableB) 
or something like that.
But test first using
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tableA WHERE email IN (SELECT email FROM tableB) 
[/code]
Nov 12 '09 #2

P: 3
Hello,

Thank you for your response

when i try to run the query, I keep getting the following error:

#1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (armscii8_bin,IMPLICIT) for operation '='

I have no clue what that means? any idea?
Nov 12 '09 #3

P: 3
I found why this is the error :

the reason was the Collation were not matching for both fields..

got it fixed.. and it worked beautifully

thank you so much !
Nov 12 '09 #4

P: 1
@code green
Work fine... thank you for great job
Sep 25 '14 #5

P: 1
Worked for me, thank you...
Jun 17 '19 #6

Post your reply

Sign in to post your reply or Sign up for a free account.