I've been trying to figure out why this gives me an error:
PREPARE test FROM 'SELECT t.blah FROM (SELECT ? AS blah) t;';
ERROR 1054 (42S22): Unknown column 't.blah' in 'field list'
also:
PREPARE test FROM 'SELECT t.* FROM (SELECT ? AS blah) t;';
ERROR 1051 (42S02): Unknown table 't'
It would be great if someone could shed some light on these errors..Thanks!!
EDIT: There is a bug report here: http://bugs.mysql.com/bug.php?id=71577
Seems like the workaround would be to do:
PREPARE test FROM 'SELECT t.blah FROM (SELECT ? AS blah UNION SELECT ? AS blah) t;';