It's especially egregious in the ORDER BY, since there you have the option of using column aliases.
# select cust_id as c, sum(avail_balance) as b from account group by c order by b;It's (IIRC!) something to do with the situation of
select x + y as x
from ...
group by x
which x are we talking about? (Logically that example is crap because only the alias x makes sense, but something like that anyway).This is frequently unavoidable, though. Or more precisely: it could be avoided with a sane database design, but the databases on which I have to work for my day job are the precise opposite of "well-designed", so grouping on complex expressions is unfortunately an inevitability.