mysql故障引用派生表中的参数化选择列

时间:2014-10-26 04:54:46

标签: mysql

这是否按设计工作? mysql不允许我从派生表中查看parmeterized列。在下面的示例中,我希望返回column1Value和column2Value,但它不会返回参数化值column2Value。

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 5.1.56-rel12.7-log |
+--------------------+
1 row in set (0.00 sec)

mysql> PREPARE stmt1 FROM 'select a.* from (select "column1value" as column1, ? as column2) a';
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> SET @a = 'column2Value';
Query OK, 0 rows affected (0.00 sec)

mysql> EXECUTE stmt1 USING @a;
+--------------+
| column1      |
+--------------+
| column1value |
+--------------+
1 row in set (0.00 sec)

0 个答案:

没有答案