Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
Cost Amount |
Author |
Message |
|
Posted : 2007-12-14 16:46:32 |
I need to find a way to calculate the cost amount of each invoice. I could not get this done yet because the purchase price is located on the inventory table and the quantity and invoice number is on the invoice line table. I did not find any relationship between these two tables to create a solution for my problem. Do you have any idea how could I solve this problem? |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2007-12-14 22:39:44 |
|
|
|
|
Posted : 2007-12-15 06:50:54 |
Try:
select * from openquery(QODBC,'SELECT "Customer"."FullName", "InvoiceLine"."InvoiceLineItemRefFullName",
"InvoiceLine"."InvoiceLineQuantity", "InvoiceLine"."InvoiceLineDesc",
"InvoiceLine"."IsPaid", "InvoiceLine"."InvoiceLineAmount", "InvoiceLine"."InvoiceLineItemRefFullName", "InvoiceLine"."InvoiceLineClassRefFullName", "InvoiceLine"."InvoiceLineRate", "ItemInventory"."PurchaseCost", "ItemInventory"."AverageCost"
FROM "Customer" "Customer","InvoiceLine" "InvoiceLine", "ItemInventory" "ItemInventory"
WHERE ("InvoiceLine"."CustomerRefListID"="Customer"."ListID")
AND ("InvoiceLine"."InvoiceLineItemRefListID" = "ItemInventory"."ListID")')
Return:
Msg 492, Level 16, State 1, Line 1
Duplicate column names are not allowed in result sets obtained through OPENQUERY and OPENROWSET. The column name "InvoiceLineItemRefFullName" is a duplicate.
Help-me?
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2007-12-15 07:52:13 |
Try:
select * from openquery(QODBC, 'SELECT Customer.FullName, InvoiceLine.InvoiceLineItemRefFullName, InvoiceLine.InvoiceLineQuantity, InvoiceLine.InvoiceLineDesc, InvoiceLine.IsPaid, InvoiceLine.InvoiceLineAmount, InvoiceLine.InvoiceLineItemRefFullName, InvoiceLine.InvoiceLineClassRefFullName, InvoiceLine.InvoiceLineRate, ItemInventory.PurchaseCost, ItemInventory.AverageCost FROM Customer, InvoiceLine, ItemInventory WHERE InvoiceLine.CustomerRefListID=Customer.ListID AND InvoiceLine.InvoiceLineItemRefListID = ItemInventory.ListID') |
|
|
|
|