All pastes #420112 Raw Edit

homersim

public sql v1 · immutable
·published 2007-04-01 21:35 UTC
rendered paste body
/* 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 ratiofrom actions as a where corpse = 'KillerMan' AND type='kill' group by killer order by kills desc