My question:
How do I get MySQL to use in a select a previouly selected value without repeating itself
My Answer, taken from another post
Set a variable direclty on the SELECT like this:
SELECT @q:= ##longQuery## AS a, (@q>2) AS b;
I had this MySQL:
SELECT ##longQuery## AS a, (a>2) AS b;
but I got:
ERROR 1054 (42S22): Unknown column 'a' in 'field list'
I didn't want to repeat the ##longQuery##, because it is actually quite lengthy on the real code.
Thank you