Home » SQL & PL/SQL » SQL & PL/SQL » How to get the names that have mistakes from 2 tables
How to get the names that have mistakes from 2 tables [message #196850] Sun, 08 October 2006 10:03 Go to next message
drhell
Messages: 1
Registered: October 2006
Junior Member
Ok here is the thing, i have two tables table1 and table2, they are supposed to contain the same information, but we have found mistakes, the tables contain peoples names and lastnames, how can i get the names that are not typed similar in the 2 tables.

Example: table1 table2
John Jonh
Amanda Amanad
Alex Alxe

I would like to make a query that gets me all the mistakes like the ones shown above. In other words a comparison of the information from the tables, since they have to be exactly the same.

Heres the tables info.

table1/table2 (id,name, last_name, adress, telephone, email, position)

i hope u understand my problem, thanks alot for the help....
Re: How to get the names that have mistakes from 2 tables [message #196851 is a reply to message #196850] Sun, 08 October 2006 10:10 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Something like this?
SELECT t1.id, t1.name, t1.last_name
FROM TEST t1, TEST2 t2
WHERE t1.id = t2.id
  AND t1.name <> t2.name;
Re: How to get the names that have mistakes from 2 tables [message #196909 is a reply to message #196850] Mon, 09 October 2006 02:09 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Or you could use MINUS:
SELECT id,name,last_name
FROM   TEST
MINUS
SELECT id,name,last_name
FROM   TEST2
Previous Topic: Lock row
Next Topic: Index not getting used when LIKE '%..%' IS USED
Goto Forum:
  


Current Time: Mon Feb 17 05:48:20 CST 2025