>We all know that you cannot do something like this;
>sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS curdate()
>nor can you use user variables even though they get set properly
>set @d1 = curdate();
>sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS @d1
>So, does anyone know of a work around?
How about PREPARE?
PREPARE treats SELECT statements the same, unless I am missing
something. I have done some testing, and have been able to obtain the
desired results. Even the simplest example;
PREPARE stmt1 FROM 'SELECT curdate() AS ?';
SET @a = curdate();
EXECUTE stmt1 USING @a;
Gives a syntax error on the PREPARE statement since AS cannot be a
function. Perhaps there is something to a prepare that I should be more