I have the following SELECT clause in Doctrine (the query itself is created using query builder):
u.username,
MAX(p.score) as highscore,
SUM(pc.badgeCount) as badgeCount,
(SUM(pc.badgeCount) / :badgeSum) AS probability,
(-LOG(RAND()) * probability) as weight
(p
is an alias for the main entity, pc
is a joined one)
This gives me an error message from MySQL:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'probability' in 'field list'
How can I reuse the created aliases within the same SELECT clause?