0
Wie kann ich dieses rohe SQL in ein named_scope umwandeln?Raw SQL zu 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)