I have found MySQL's IF() function to be very useful in giving me an efficient way to do conditional aggregate functions, like this:
SELECT SUM(IF(`something`='a', `something_weight`, 0)) AS `A`, SUM(`something_weight`) AS `All` FROM...
It is my understanding that this function is a feature of MySQL, and is not generally available in databases that use SQL.
Is there a more standard method to achieve this functionality on the database side of things?