私はこのクエリを持っているので、最初のクエリにwhere句(WHERE order_number = 1
)を追加する必要がありますが、それは機能しません。内部結合のWHERE句はどこに追加しますか?
SELECT
last_name,
first_name,
total,
pickup_date,
MPU.salary,
MTU.materials,
OFU.otherfee
FROM
finished AS FD
INNER JOIN
(SELECT
order_number, (SUM(salary * hours_worked)) AS 'salary'
FROM
manpower_used
GROUP BY order_number) AS MPU ON FD.order_number = MPU.order_number
INNER JOIN
(SELECT
order_number, (SUM(qty * price)) AS 'materials'
FROM
materials_used
GROUP BY order_number) AS MTU ON FD.order_number = MTU.order_number
INNER JOIN
(SELECT
order_number,
(SUM(overtime_fee + stair_fee + toll_fee)) AS 'otherfee'
FROM
other_fees
GROUP BY order_number) AS OFU ON FD.order_number = OFU.order_number
ありがとう!
where
句などの終わりにそうあなたの質問の最後に、FD.order_number = MPU.order_numberとfd.order_number = 1' –という条件があります。 – kritikaTalwar