如何使用GROUP BY准备好的语句?

时间:2014-07-28 19:13:13

标签: php mysql sql prepared-statement

我有一个准备好的声明,我正在尝试运行但是当它绑定参数时我最终会

GROUP BY "Column"

而不是

GROUP BY Column

以结果说明结束

"Column" | 2
"Column" | 3

而不是从列中取值并替换它们。当我对其进行硬编码时,查询运行得非常完美,只有当我准备并绑定它才开始变得难以理解时。

编辑:整个查询

$sql = "SELECT ?, COUNT(?) FROM (
            SELECT ? FROM keno
            WHERE Date = '7/21/2014'
            ORDER BY `Game Number` ASC
            LIMIT ?
        ) as temp_table
        GROUP BY ?
        ORDER BY ? ASC";

和绑定

$current_position = "One";
$limit = $i + 1 //Inside a for loop
$qry->bind_param("sssiss", $current_position, $current_position, $current_position, $limit, $current_position, $current_position)

0 个答案:

没有答案