以下查询在MySql 5.7.25版本上运行良好,并返回列“ a”,“ b”,“ c”和“ days”。 但是在5.1.73版中,它仍然可以运行,但仅返回1列-“天”。
PREPARE stmt1 FROM '
SELECT
results.*
FROM
(
SELECT
? AS a,
? AS b,
? AS c,
DATEDIFF(?, ?) AS days
) AS results
';
SET @a = '2018-09-04';
SET @b = '2018-10-04';
SET @c = 'TESTTESTTEST';
EXECUTE stmt1 USING @a, @b, @c, @b, @a;
有人知道如何获得5.1.73版返回的所有列吗?
更新-临时修复,直到我们能够升级:
SELECT
IFNULL(?,"") AS a,
IFNULL(?,"") AS b,
IFNULL(?,"") AS c,
...
似乎可以正常工作。