Understanding group bys
Published on Apr 18, 2009
Yesterday, at work, it occurred to me, not for the first time, that something that comes so easily to me, does not to others. I had tasked someone with, what seemed a simple task, to retrieve a list of users who have reached minimum payout.
The payouts were stored in a separate table from the users and users could have multiple payment records prior to reaching payout, thus we would need to use a SUM() on the amount. Because we also required other data, we need to use a group by to properly sum the amounts a user has.
The task was handed back to me several hours later to review, it was quite evident that the main concept was "grasped", but the understanding of group bys was not.