General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Hi Caroline,
How about something like this:
SELECT a.iid, b.iid as iid__duplicate;
FROM duplicates!addresses a, duplicates!addresses b;
WHERE b.iid > a.iid;
AND a.csurname == b.csurname;
AND a.cforename == b.cforename;
AND (a.caddress_1 == b.caddress_1;
OR (a.cpostcode == b.cpostcode));
ORDER BY a.csurname, a.cforename, a.iid
This should result in:
iid iid__duplicate
1 2
1 3
2 3
The key difference is using > vs. <>.
When I use a similar approach, I assume that newer rows have a higher value for the UID, but I think it works regardless.
HTH
Blue Skies!
Joe
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only