考虑 cross join 生成用户和成就的所有组合,以及 not exists 具有相关子查询的条件,以筛选出已完成的子查询:
select u.id_user, a.id_achievement
from users u
cross join achievements a
where not exists (
select 1
from user_achievements ua
where ua.id_user = u.id_user and ua.id_achievement = a.id_achievement
)
1条答案
按热度按时间6rqinv9w1#
考虑
cross join
生成用户和成就的所有组合,以及not exists
具有相关子查询的条件,以筛选出已完成的子查询: