/* WHY DOES THIS WORK ... */ select killer, (count('')) as kills, (SELECT count('') from actions where killer='KillerMan' and corpse=a.killer and type='kill') as deaths from actions as a where corpse = 'KillerMan' AND type='kill' group by killer order by kills desc /* ... BUT NOT THIS? */ select killer, (count('')) as kills, (SELECT count('') from actions where killer='KillerMan' and corpse=a.killer and type='kill') as deaths, (kills/deaths) as ratio from actions as a where corpse = 'KillerMan' AND type='kill' group by killer order by kills desc