Subject Possible Firebird BUG?
Author Fabian Chocron
Hi Guys,

I think this is a bug, The problem is quite simple, if I include an "Alias" of a file in the "Select" I dont get a the proper value.

Let's see the Example:

SELECT AGENT.AGENTCODE , AGENT.NAME , ENGINEER.NAME , INCENG.INCNO , INCENG.SEQNO , ACTIVINC.CSONUMBER , ACTIVINC.CASETYPE , ACTIVINC.MACHINECODE , ACTIVINC.SERIAL , INCENG.RUNSEQ , INCENG.ENGDUEDATE , INCENG.ENGDUETIME , INCENG.ARRIVALDATE , INCENG.ARRIVALTIME , INCENG.FINISHDATE , INCENG.FINISHTIME , INCENG.TRAVELTIME , INCENG.SITETIME , INCENG.TRAVELZONE , ACTIVINC.ADDDATE , ACTIVINC.ADDTIME , ACTIVINC.DATECLOSED ,

/* until here it is irrelevant, now the important part */
count(P1.PFIID) AS TOTALUSEDPARTS , Count(P2.PFIID) AS TOTALDOAPARTS
/* NOTE THAT P1 AND P2 ARE THE SAME TABLE, BUT WITH A DIFFERENT CONDITION IN THE "AND" SECTION */

from INCENG , AGENT , ENGINEER, ACTIVINC , PARTSFORINCIDENT P1 , PARTSFORINCIDENT P2
where INCENG.IESTATUSID = 6
AND ACTIVINC.INCNO = INCENG.INCNO
AND AGENT.AGENTID = INCENG.AGENTID
AND ENGINEER.ENGINEERID = INCENG.ENGINEERID

/* HERE THE IMPORTANT PART FOR FILTERING P1 AND P2 */
AND P1.INCNO = INCENG.INCNO
AND P1.PARTSFAILID = 1 /* 1 = Used Part */
AND P2.INCNO = INCENG.INCNO
AND P2.PARTSFAILID = 3 /* 1 = DOA Part */

/* END OF IMPORTANT SECTION*/

group by AGENT.AGENTCODE , AGENT.NAME , ENGINEER.NAME , INCENG.INCNO , INCENG.SEQNO , ACTIVINC.CSONUMBER , ACTIVINC.CASETYPE , ACTIVINC.MACHINECODE , ACTIVINC.SERIAL , INCENG.RUNSEQ , INCENG.ENGDUEDATE ,
INCENG.ENGDUETIME , INCENG.ARRIVALDATE , INCENG.ARRIVALTIME , INCENG.FINISHDATE , INCENG.FINISHTIME ,
INCENG.TRAVELTIME , INCENG.SITETIME , INCENG.TRAVELZONE , ACTIVINC.ADDDATE , ACTIVINC.ADDTIME ,
ACTIVINC.DATECLOSED
;


so, the problem is that when it runs, TOTALUSEDPARTS and TOTALDOAPARTS return the same value, but running a separated
Select the values are different, so I guess this is a bug.


Any Comments?

Cheers,
Fabian.

[Non-text portions of this message have been removed]