描述
题解
生成序列表
with recursive t1 as
(select 1 as ids
union all
select ids+1 from t1
where ids<(select max(customer_id) from Customers))
用序列表与骨科表外连接筛选出剩余的id
select t1.ids
from t1 left join Customers as a on t1.ids=a.customer_id
where a.customer_name is null;
写一起
with recursive t1 as
(select 1 as ids
union all
select ids+1 from t1
where ids<(select max(customer_id) from Customers))
select t1.ids
from t1 left join Customers as a on t1.ids=a.customer_id
where a.customer_name is null;