我需要从具有多个if条件的表中获取数据。我有3个表:问题,级别,难度级别,用于获取数据。
EG:
Select *
from questions q
join level l on l.id = q.level_id
join difficulty_level dl on dl.id = q.difficulty_level_id
where:
1. difficulty_level = 'easy', limit l.easy_question_count
2. difficulty_level = 'medium', limit l.medium_question_count
3. difficulty_level = 'hard', limit l.hard_question_count
and l.id = some_id
有没有办法可以在一个查询中获取数据?