我正在尝试调试我自己没有编写的 SQL 语句:
$stmt = $dbh->prepare("
SELECT
Customer.Primary_Email AS EMAIL,
...
FROM Order_SG
INNER JOIN Customer USING (Customer__)
INNER JOIN Order_SG_Detail USING (Order_SG__)
INNER JOIN Product_Ref USING (Product_Ref__)
INNER JOIN Reduction USING (Reduction__)
WHERE Order_SG.Server__ IN (:servers)
...
AND `DATE` BETWEEN :startDate AND :endDate
LIMIT :limit
OFFSET :offset");
$stmt->bindValue(':servers', implode(',', $servers));
$stmt->bindValue(':startDate', $startDate);
$stmt->bindValue(':endDate', $endDate);
$stmt->bindValue(':limit', $limit, \PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, \PDO::PARAM_INT);
绑定后如何检索语句?我可以的字符串echo
很好。