从 table B 中删除列值类似于 table a 的通配符
Delete from table B where column value like table a with wildcards
所以我有两个表
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
中不包含来自 seeds
的 domain
的行
What have you tried?
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)
这两个查询都只是删除所有行
所以我有两个表
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
中不包含来自 seeds
domain
的行
What have you tried?
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)
这两个查询都只是删除所有行