April15Hater
Accountant
- Local time
- Today, 17:51
- Joined
- Sep 12, 2008
- Messages
- 349
Hi Guys-
I have three tables in this scenario: tblFunction, tblContractorFunction, and tblInvoiceFunction. tblContractorFunction and tblInvoiceFunction have a 1-M relationship to tblFunction yet share FunctionType as the common foreign key (which is actually a text value). I want the query to list the FunctionTypes as the rows with the cost as one column and the price in another. My SQL below did that but I need to be able to edit the cost and price values which it is not allowing me to do. I attached my relationship diagram as well.
<EDIT>FORGOT TO MENTION: When I have just (tblFunction and tblContractorFunction) or (tblFunction and tblInvoiceFunction) alone, I can update but obviously by doing that, the corresponding Price/Cost (respectively) will not show.
Thanks,
Joe
I have three tables in this scenario: tblFunction, tblContractorFunction, and tblInvoiceFunction. tblContractorFunction and tblInvoiceFunction have a 1-M relationship to tblFunction yet share FunctionType as the common foreign key (which is actually a text value). I want the query to list the FunctionTypes as the rows with the cost as one column and the price in another. My SQL below did that but I need to be able to edit the cost and price values which it is not allowing me to do. I attached my relationship diagram as well.
<EDIT>FORGOT TO MENTION: When I have just (tblFunction and tblContractorFunction) or (tblFunction and tblInvoiceFunction) alone, I can update but obviously by doing that, the corresponding Price/Cost (respectively) will not show.
Thanks,
Joe
Code:
SELECT tblInvoiceFunction.Price, tblContractorFunction.FunctionCost,
tblContractorFunction.FunctionType, tblInvoiceFunction.FunctionType
FROM (tblFunction INNER JOIN tblInvoiceFunction ON
tblFunction.FunctionID = tblInvoiceFunction.FunctionID) INNER JOIN
tblContractorFunction ON (tblContractorFunction.FunctionType =
tblInvoiceFunction.FunctionType) AND (tblFunction.FunctionID =
tblContractorFunction.FunctionID)
WHERE (((tblFunction.FunctionID)=3));
Attachments
Last edited: