我正在尝试将其他表中的记录插入到 store_orders_items 中。例如:
INSERT INTO store_orders_items( order_id, sel_item_id, sel_item_price)
SELECT order_id, sel_item_id, sel_item_price
FROM orders_ids
INNER JOIN store_orders ON store_orders.id = orders_ids.order_id
INNER JOIN store_shoppertrack ON store_items.id=store_shoppertrack.sel_item_id
Where session_id = '".$_COOKIE["PHPSESSID"]."';
然后我收到以下消息:“字段列表”中的未知列“sel_item_price”。我试图将 sel_item_price 设置为 item_price 无济于事。这是我的表:
store_orders_items:
id| order_id | sel_item_id |sel_item_price|
-------------------------------------------
| | | |
store_shoppertrack:
id| session_id | sel_item_id |date_added|
-------------------------------------------
| | | |
商店订单:
id| item_total| order_date|
---------------------------
| | |
商店物品:
id| item_price| item_color|
---------------------------
| | |
订单ID:
id| order_id | status|
----------------------
| | |