Subject Re: [IBO] Problem with TIBOQuery
Author Aage Johansen
Hans wrote:
> The original query was something like
>
> select Account, Invoice , ' ' from ArInv
> where Period = :P
> join
> select Account, Invoice , CheckNo from ApInv
> where Period = :P
>
> This resulted in x number of records for a report.
> The Report software issued a RecordCount against
> the above Query to get its PageNumbering correct
> in the format of Page n of m
>
> IBO is pretty smart about this and converted the
> RecordCount request to
>
> select Count(*) from ArInv
> where Period = :P
> join
> select Account, Invoice , CheckNo from ApInv
> where Period = :P

But not smart enough, I see!

>
> which is not quite a correct SQL query and raised
> an exception.
>
> A small modification issues automaitically 2 queries
> 1. select Count(*) from ArInv
> where Period = :P
> 2. select AccountCount(*) from ApInv
> where Period = :P
> and returns the sum of 1 and 2 as the RecordCount
>
> Old Program and is now content and produces
> the report correctly.
>

Ok, if the "join" in the queries above really is a "union all".
For a "union", the sum of (1) and (2) will in the general case not
necessarily be what you want.


btw:
>> What did FlushBuffers do with an IB (or Fb) database?


--
Aage J.