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
|
|
In-Line View Support |
Author |
Message |
robc |
|
Group | : Members |
Posts | : 13 |
Joined | : 2006-04-27 |
|
Profile |
|
Posted : 2006-04-27 07:53:26 |
Does QODBC support inline views?
Example:
select cust.FullName from customer cust left outer join (SELECT CustomerRefListID, max(TxnDate) AS maxDate FROM invoice GROUP BY CustomerRefListID) inv2 on inv2.CustomerRefListID = cust.ListId |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 08:21:31 |
QODBC currently only supports nested sub-selects & "exists", for example:
SELECT * FROM EMPLOYEE WHERE NAME IN (SELECT NAME FROM EMPLOYEE)
SELECT FullName FROM Customer cust WHERE EXISTS (SELECT CustomerRefListID, max(TxnDate) AS maxDate FROM invoice GROUP BY CustomerRefListID) |
|
|
|
robc |
|
Group | : Members |
Posts | : 13 |
Joined | : 2006-04-27 |
|
Profile |
|
Posted : 2006-04-27 08:32:32 |
Thank you for your very speedy reply. Can you suggest how I would write a query that would associate each customer record with it's most recent invoice record if one exists? |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 09:39:15 |
Most of the customer details are already within the invoice. So most of the time you don't need to link tables in QODBC as most of the header details are always embedded in the transactions. The headers in QODBC act as placeholders. But if you wanted to see, say the JobEndDate, you can link the tables like this:
SELECT InvoiceLine.CustomerRefListID, InvoiceLine.CustomerRefFullName, InvoiceLine.TxnDate, InvoiceLine.InvoiceLineDesc, InvoiceLine.InvoiceLineQuantity, Customer.Balance, Customer.JobEndDate FROM Customer Customer, InvoiceLine InvoiceLine WHERE InvoiceLine.CustomerRefListID = Customer.ListID
or do:
SELECT FullName, JobEndDate FROM Customer cust WHERE EXISTS (SELECT CustomerRefListID, max(TxnDate) AS maxDate FROM invoice GROUP BY CustomerRefListID) |
|
|
|
robc |
|
Group | : Members |
Posts | : 13 |
Joined | : 2006-04-27 |
|
Profile |
|
Posted : 2006-04-27 09:57:14 |
I know you are really trying to help and I don't want to belabor the point, but I don't see how to get this simple task done. The query provided will only select customers that have invoices, which is not what I need, plus it returns none of the invoice data for the most current invoice for each customer.
The other solution is to link to the tables, but the query I wrote to do this (see first message) will not run because in-line views are not supported. Sounds like I am at an impass here. This is the first task I have tried since downloading the trial version of the QODDB driver.
Thank you. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 10:18:51 |
That's right, if you do a GROUP BY the details are lost (but you started down this road .. not me), but this will do what you want:
SELECT InvoiceLine.CustomerRefListID, InvoiceLine.CustomerRefFullName, InvoiceLine.TxnDate, InvoiceLine.InvoiceLineDesc, InvoiceLine.InvoiceLineQuantity, Customer.Balance, Customer.JobEndDate FROM Customer Customer, InvoiceLine InvoiceLine WHERE InvoiceLine.CustomerRefListID = Customer.ListID
|
|
|
|
robc |
|
Group | : Members |
Posts | : 13 |
Joined | : 2006-04-27 |
|
Profile |
|
Posted : 2006-04-27 10:28:57 |
Ok, so the invoice line file only contains invoice data for the most current invoice, who knew. We thought it contained data for all the invoices for that customer. I only wanted the most current invoice, and that is why I had to do the group by, to get the max transaction date for all the invoices for that customer. We didn't know that about the invoice line table.
Thank you. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 11:05:36 |
No,
Invoice: Is the Main Invoice Table and contains a HEADER rowset for every invoice. InvoiceLine: Provides line item detail rowsets for each customer invoice; contains all the information included in the Main Invoice Table InvoiceLinkedTxn: Payments, Credit Memos, Deposit Line Items; does NOT include reimbursements, transfers from SO or Estimates |
|
|
|
robc |
|
Group | : Members |
Posts | : 13 |
Joined | : 2006-04-27 |
|
Profile |
|
Posted : 2006-04-28 02:06:57 |
Ok, I will just assume that it is not possible to do what I need with the QODBC driver, or at least neither of us can figure out how to do it. We could have saved a lot of time by just saying that in the beginning. However, the driver is saving me billions of hours of hard work, and I do very much appreciate what it does do. I am sure I will purchase the license for it.
Thank you. |
|
|
|
|