473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing Two Tables and Deleting duplicate

3 New Member
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
7 14094
code green
1,726 Recognized Expert Top Contributor
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
nhatto
3 New Member
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,I MPLICIT) for operation '='

I have no clue what that means? any idea?
Nov 12 '09 #3
nhatto
3 New Member
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
PreethiBugs
1 New Member
@code green
Work fine... thank you for great job
Sep 25 '14 #5
romiardisaja
1 New Member
Worked for me, thank you...
Jun 17 '19 #6
gosai jahnvi
22 New Member
You can try this, I hope it will assist you.

Expand|Select|Wrap|Line Numbers
  1. DELETE table1 
  2. FROM table1 
  3. INNER JOIN table2 ON table1.name = table2.name
  4. WHERE table1.id = table2.id
thank you.
Aug 5 '19 #7
shivkumar1
4 New Member
Expand|Select|Wrap|Line Numbers
  1. DELETE a
  2. FROM a  -- first table
  3. INNER JOIN b -- second table
  4.       ON b.ID = a.ID
  5.       AND b.Name = a.Name
  6.       AND b.Foo = a.Foo
  7.       AND b.Bar = a.Bar
That should do it... there is also CHECKSUM(*), but this only helps - you'd still need to check the actual values to preclude hash-conflicts.
Aug 19 '19 #8

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

Similar topics

2
3447
by: Bill | last post by:
I have an entry form allowing customers to enter up to 15 skus (product id) at a time, so they can make a multiple order, instead of entering one sku, then submitting it, then returing to the form to submit the second one, and so forth. From time to time, the sku they enter will be wrong, or discontiued, so it will not submit an order. ...
25
2201
by: David | last post by:
I've got a 50k main.css file that's referenced by a load of sites. Each of these sites also has a site.css file that modifies certain styles defined in main.css. Changing the colour of borders, boxes etc, as well as defining certain site specific styles. site.css is small and easy to understand, and the only bit that can be edited by the...
18
2456
by: Dan | last post by:
hello, I would to know if it is possible to delete an instance in an array, The following does not allow me to do a delete. I am trying to find and delete the duplicate in an array, thanks for ( j =0; j<MAX ; j++) { for ( i =0; i<MAX ; i++)
12
5139
by: NickName | last post by:
I have the following situation. One set of data has 274 rows (set2) and anther has 264 (set1). Both data sets are similar in structure as well as values for both of them were extracts from the same parent table. Hope the info would substitute DDL. I need to find the "gap" rows between these two sets. Attempted to run a query like select...
3
2747
by: Nathan Bloom | last post by:
Hi, I have a data entry form (access 2000) that also allows the user to add, update, and delete records from the form. The Delete action is carried out in an event procedure and has the following code: Private Sub Command28_Click() On Error GoTo Err_Command28_Click
5
2768
by: ken | last post by:
Hi, Do Junction Tables need ID fields with Primary keys? For example if you store employee ID, employee name, Company ID, Company name. As you can see no field here can be a primary key since all of the columns will have repeatable values. So does one need to put in an autonumber field and make it a primary key? thanks
5
3981
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone | ------------------------------------------------------- | mr x | 8th lane | 124364 | | mr x | 6th lane | 435783 | | mrs x | 6th lane |...
4
3294
by: HLCruz via AccessMonster.com | last post by:
I am working with a database that has client information separated in to 4 related tables - tFolder, tAddress, tEmail, tPhone number. In addition there are related tables tGifts and tCalls. The database has roughly 22,000 records but should only have around 6,000. The remaining records are duplicates, but in many cases the correct data for...
1
3409
by: jignasha1234567 | last post by:
hi, how can i delete data from one table which is similar to another data in another table having same coloumn name. suppose i have one table name test1 and another table named test2 . test1 has columns let take one,two,three and test2 has same column as well. Then i am able to compare the data which is similar to both tables in...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.