I have two tables. tl
and t2
. Each table has the columns: ID
, name
. The ID
is a PK and Auto increment. The two tables are not connected to each other. The t2.name
is a subset of t1.name
, but after adding www.
at the beginning of the string in the name
.
Ex:
`t1`.`name`= ggg
`t2`.`name`= www.ggg
What I am trying to do is: selecting all the record of where t1.name
not inserted in t2
. So I wrote the following query:
select concat('www.',name)
from db.t1
LEFT JOIN db.t2
ON t2.name = t1.name
WHERE NOT EXISTS (select name from db.t2);
But, I get 0 result. I am certain that there are records that are available in t1 but not in t2. How can I select all the names in t1 that are not in t2??