0
如何將此原始SQL轉換爲named_scope?將原始SQL轉換爲named_scope
select d.*, count(*) shots_count
from duels d, duel_shots ds
where d.id = ds.duel_id
group by d.id
having (d.shots = 1 and shots_count >= 2) or (d.shots = 3 and shots_count >= 6)