问题描述
所以我有两个桌子
seeds
- id
- domain
subdomain
- id
- domain
- ip
我要针对域过滤子域
例如
seeds
Id Domain
0 google.com
1 test.com
subdomain
Id domain ip
0 test.google.com null
1 api.google.com null
2 dnr.com null
3 neveRSSl.com null
我正在尝试编写一个查询,以从subdomain
删除domain
中不包含seeds
的行
您尝试了什么?
delete subdomain
where id not in
(select subs.id from seed as seeds
join
subdomain as subs on subs.domain
like concat('%',seeds.domain));
和
delete subdomain
where id not in
(SELECT sd.id
FROM subdomain sd
LEFT JOIN seed s
ON sd.domain LIKE CONCAT('%',s.Domain)
WHERE s.id IS NULL)