1
我正在使用以下查詢從Opencart DB中選擇數據。這一切都工作正常,直到最後的連接,我連接product_to_category表,然後我得到1064錯誤。沒有那個加入查詢工作正常 - 任何人都可以幫忙嗎?SQL語法中的Opencart SQL錯誤錯誤號1064
$purchased = "SELECT op.quantity, oo.product_option_value_id, oo.product_option_id, op.order_product_id,op.product_id,op.name,o.order_id,ptc.product_id
FROM `order` o
JOIN `order_product` op ON o.order_id = op.order_id
LEFT JOIN `order_option` oo ON op.order_product_id = oo.order_product_id
LEFT JOIN 'product_to_category' ptc ON op.product_id = ptc.product_id";
if (!empty($data['filter_date_start'])) {
$purchased .= " WHERE DATE(o.date_added) >= '" . $this->db- >escape($data['filter_date_start']) . "'";
} else {
$purchased .= " WHERE DATE(o.date_added) >= '1900-01-01'";
}
if (!empty($data['filter_date_end'])) {
$purchased .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
}