查询address中未被thing过使用的地址
select * from address where not exists (select 1 from thing where thing.address_id = address.id);
删除只需要把select * 换为delete即可
删除address中未被thing过使用的地址
delete from address where not exists (select 1 from thing where thing.address_id = address.id);
网友评论