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



During a re-write of a very large software system we were having some difficulties utilizing a 3rd party grid that we had chosen. The dataset connectivity was very flaky due to the complex joins and updates we were using which caused the grids to behave very sketchy.  FIBPlus was the perfect solution for us. After implementing it everything became so much easier. The grid functionality stabilized, data retrieval was much faster, and we were pleasantly surprised by many of the unique features of your components. We were especially impressed with your pFIBUpdateObject components which allowed us to very easily update the multiple tables we were using in our joins.  Many thanks for your great components.

>>

Tracy Anderson, Team Leader, EDSS Division of AADG, Inc.
FOR CUSTOMERS
Download full versions and updates in your Personal Area