I have this sql query that compares two tables (t1 to t2) and creates a new table with anything that doesn't exist in the 'site' colum of t1:
CREATE TABLE newtable
SELECT t1.site, t1.rank
FROM t1
LEFT OUTER
JOIN t2
ON t2.site = t1.site
WHERE t2.site IS NULL
This works fine but I need the sql query to compare 'site' fields in t1 and t2 and recognise 'google.com/users/test.html' or 'google.com' or ' to be the same domain therefore not outputting it to the new table.
Perhaps with regexp? Not sure how to go about this though.
Any help would be appreciated!
CREATE TABLE newtable
SELECT t1.site, t1.rank
FROM t1
LEFT OUTER
JOIN t2
ON t2.site = t1.site
WHERE t2.site IS NULL
This works fine but I need the sql query to compare 'site' fields in t1 and t2 and recognise 'google.com/users/test.html' or 'google.com' or ' to be the same domain therefore not outputting it to the new table.
Perhaps with regexp? Not sure how to go about this though.
Any help would be appreciated!