Question: Why in FIBPlus 6.5 do I get an error "COLUMN The column ... was specified multiple times for derived table unnamed." in some queries?

An example of such a query:

SELECT PAYMENTS.ID,PAYMENTS.DATE_ORDER,PAYMENTS.SERVICE_STATUS,MAIN.ID,
MAIN.CLNT,CLIENTS.ID,CLIENTS.R FROM PAYMENTS
LEFT JOIN MAIN ON PAYMENTS.ID_COMPANY=MAIN.ID
LEFT JOIN CLIENTS ON MAIN.clnt=CLIENTS.ID WHERE PAYMENTS.
SERVICE_STATUS=0 AND PAYMENTS.DATE_ORDER IS NOT NULL

This example works well everywhere (in IBExpert, console, etc).

Answer: This happens because you try to execute this query from pFIBDataset with an active poAskRecordCount option for Firebird 2.x.

If you use Firebird 2.x, poAskRecordCount uses Select Count(*) from (Select...)

In your case the query will be:

Select Count(*) from (SELECT PAYMENTS.ID,PAYMENTS.DATE_ORDER,PAYMENTS.
SERVICE_STATUS,MAIN.ID,MAIN.CLNT,CLIENTS.ID,CLIENTS.R FROM PAYMENTS
LEFT JOIN MAIN ON PAYMENTS.ID_COMPANY=MAIN.ID
LEFT JOIN CLIENTS ON MAIN.clnt=CLIENTS.ID WHERE PAYMENTS.
SERVICE_STATUS=0 AND PAYMENTS.DATE_ORDER IS NOT NULL )

As Firebird 2.x cannot execute this query, it shows the error "COLUMN The column ... was specified multiple times for derived table unnamed." In other words, this happens because the error is in the query which realises the poAskRecordCount function.

If you write the query as:

SELECT PAYMENTS.ID,PAYMENTS.DATE_ORDER,PAYMENTS.
SERVICE_STATUS,MAIN.ID ID1 ,MAIN.CLNT,CLIENTS.ID ID2,CLIENTS.R FROM PAYMENTS
LEFT JOIN MAIN ON PAYMENTS.ID_COMPANY=MAIN.ID
LEFT JOIN CLIENTS ON MAIN.clnt=CLIENTS.ID WHERE PAYMENTS.
SERVICE_STATUS=0 AND PAYMENTS.DATE_ORDER IS NOT NULL

everything will work correctly. So you should either deactivate the poAskRecordCount option in the dataset or rewrite the query.


Preview text: 
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...

Navigation



We are a small software company with thousands of customers delivering comany wide systems including accounting, logistics, e-commerce, POS, sales etc etc. Several years ago, when we were still a very small company, we used Delphi 3 and Paradox combined with BDE. As our system (and customer base) grew I decided to switch to Delphi 5 and Interbase. Being a huge improvement over Delphi 3 and Paradox, I encountered numerous problems with IBX: memory leaks, performance issues and other problems. Borland was not to be bothered: IBX was provided "as is" and no support was avaliable. 
Not being very eager to use third party components with Delphi at first, I decided to give FIBPlus a try. At once all problems where gone: no more memory leaks and  performance was very consistent. 
But the real advantage of switching to FIBPlus came with the upgrade to D2005: after upgrading there were some problems with the new FIBPlus version. After emailing the problem I received an update within an hour! And this was at 11 pm! A few other (smaller) errors where handled in the same way. 
Our motto is: software is as good as its support. And support of Devrace is just great!
Just a little indication of our FIBPlus use: all our software runs 100% on FIBPlus. Our customers have a total of aprox. 4.800 Firebird databases in production, with a combined size of over 130TB and over 80 million transactions a day. Every
day. And FIBPlus has not failed a single transaction. Not once. There is, however, one (minor) drawback in using FIBPlus: while debugging an application which uses and invalid SQL instruction, de Delphi Debugger returns to the FIBPlus code instead of to our calling code (where the actual error comes from), thereby complicating de debug proces a little. But that is a very small price to pay for a otherwise brilliant third party solution! >>

Bas Jordans JorSoft Ltd
FOR CUSTOMERS
Download full versions and updates in your Personal Area