实际上,Opencart默认模型查询是否有我想在查询内部添加AND条件(我想添加电子邮件字段,电子邮件在订单表中)如何使AND条件对任何人都有用。 我的查询如下:
branch
答案 0 :(得分:0)
只需阅读: https://www.w3schools.com/sql/sql_and_or.asp
带有连接表的实时示例:
$sql = "SELECT o.order_id,
CONCAT(o.firstname, ' ', o.lastname) AS customer,
(SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status,
o.invoice_prefix,
o.invoice_no,
o.shipping_code,
o.total,
o.currency_code,
o.currency_value,
o.date_added,
o.date_modified,
ot.value
FROM `" . DB_PREFIX . "order` o
LEFT JOIN `" . DB_PREFIX . "order_total` ot ON ot.order_id = o.order_id AND ot.code = 'total'";