0
嗨,大家好,所以這是我第一次搶斷內加入讓不勝感激任何幫助。不是唯一的表/別名:「產品」
只是想知道爲什麼我從我所創建的代碼得到以下錯誤:
不是唯一的表/別名:「產品」
這裏是代碼本身:
mysql_select_db($database_reps, $reps);
$query_orders = sprintf("SELECT
orders.ID AS mainID,
customers.`Name` AS customerName,
products.ProductName AS product,
orders.Quantity AS Quantity,
orders.comment As comment,
orders.SalesPrice AS SalesPrice,
orders.Price AS Price,
orders.paid AS paid,
orders.product2 AS product2,
orders.AgeOfPayment AS AgeOfPayment,
orders.orderDate AS orderDate,
products.Price AS productPrice,
staff.StaffName AS staffMember,
orders.bonus AS bonus
FROM
orders
INNER JOIN staff AS staff ON orders.staffMember = staff.ID
INNER JOIN products AS products ON orders.product = products.ID
INNER JOIN products AS products ON orders.product2 = products.ID
INNER JOIN customers AS customers ON orders.customerName = customers.ID
WHERE
orders.ID = %s", GetSQLValueString($colname_orders, "int"));
$orders = mysql_query($query_orders, $reps) or die(mysql_error());
$row_orders = mysql_fetch_assoc($orders);
$totalRows_orders = mysql_num_rows($orders);
聯盟證明有點困難,但任何幫助非常感謝。
嗨,馬克,爲感謝。我只是有點好奇的佈局。你能給我一個你的意思嗎? – Rich
您希望在您選擇的列列表中看到哪個產品名稱和價格?與orders.product匹配的名稱/價格,還是與orders.product2相匹配的名稱/價格?或兩者? –
@ user2598646來吧,告訴我們你的第一 – Strawberry