-1
私はこのPHP MySQLクエリをすべての午後に修正しようとしていて、私の心が失われています!次のクエリが動作します。:PHP MySQLクエリステートメントの問題
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, o.shipping_code, o.total, o.channel, o.currency_code, o.currency_value, o.date_added, o.date_modified, c.image,
cg.name AS cgroup, CONCAT(o.payment_address_1, '<br>', o.payment_city, ', ', o.payment_zone, ' ', o.payment_postcode) AS address, o.telephone AS phone, o.email AS email,
(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 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "customer` c ON(o.customer_id=c.customer_id) LEFT JOIN `" . DB_PREFIX . "customer_group_description`
cg ON(c.customer_group_id=cg.customer_group_id)";
しかし、次のクエリを追加しようとすると、それが壊れます。
(SELECT action FROM " . DB_PREFIX . "donate_history h LEFT JOIN " . DB_prefix . "order od ON (h.customer_id = od.customer_id)),
私はそれを正しく書いていません。私はそれを書き直し、部品を取り除き、できるだけシンプルにしようとしましたが、修正できません。
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, o.shipping_code, o.total, o.channel, o.currency_code, o.currency_value, o.date_added, o.date_modified, c.image,
cg.name AS cgroup, CONCAT(o.payment_address_1, '<br>', o.payment_city, ', ', o.payment_zone, ' ', o.payment_postcode) AS address, o.telephone AS phone, o.email AS email,
(SELECT action FROM " . DB_PREFIX . "donate_history h LEFT JOIN " . DB_prefix . "order od ON (h.customer_id = od.customer_id)),
(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 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "customer` c ON(o.customer_id=c.customer_id) LEFT JOIN `" . DB_PREFIX . "customer_group_description`
cg ON(c.customer_group_id=cg.customer_group_id)";
エラーは何ですか? – Ali
列のエイリアスがありません。閉じ括弧の後に ''アクションのようなものを書くと、他の人が私の言いたいことを見てください。 – Bryan
2つの観察:テーブル 'オーダー'を呼び出すことは問題を求めています。 payment_address_2があればどうなりますか? – Strawberry