SQL command:
SELECT message, count(message) as amount
FROM 'messages'
WHERE LENGTH(message) >= 4 AND amount < 30 AND message != '#ddd' AND message != 'ddd'
GROUP BY message
ORDER BY amount DESC
LIMIT 3
# 1054 - Unknown column 'amount' in 'where clause'
Why does not it identify the amount being defined at the outset?