Subject | Re: [IBO] Problem with TIBOQuery |
---|---|
Author | Aage Johansen |
Post date | 2005-02-02T23:19:33Z |
Hans wrote:
For a "union", the sum of (1) and (2) will in the general case not
necessarily be what you want.
btw:
Aage J.
> The original query was something likeBut not smart enough, I see!
>
> 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
>Ok, if the "join" in the queries above really is a "union all".
> 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.
>
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.