Subject | Re: [IBO] RecordCount gives strange error |
---|---|
Author | Svein Erling Tysvær |
Post date | 2007-01-22T12:50:54Z |
With UNION ALL this could in theory be done like you suggest. With
UNION it would be difficult since you have to eliminate duplicates.
Counting the number of rows in a UNIONed result set isn't something I
would expect IBO to be able to do, and I'd say returning an error for
Fb 1.5 or lower is OK. For Firebird 2, derived tables are supported, so
select count(*)
from
(query 1
union
query 2)
should be able to work.
Set
UNION it would be difficult since you have to eliminate duplicates.
Counting the number of rows in a UNIONed result set isn't something I
would expect IBO to be able to do, and I'd say returning an error for
Fb 1.5 or lower is OK. For Firebird 2, derived tables are supported, so
select count(*)
from
(query 1
union
query 2)
should be able to work.
Set
--- In IBObjects@yahoogroups.com, "Joe Martinez" wrote:
> I see. I suppose a good solution would be for IBO to split the
> queries up, run the count(*) separately on each one, add the results
> together, and return that.
>
> BTW, the reason that I use RecordCount is so that I can display an
> accurate progress bar when generating a report based on the results
> of the query.
>
> -Joe
>
> > You're asking the Fb/IB engine to do something it can't do - in
> > this case, to perform select count(*) on a unioned set.
> >
> > Recordcount belongs to Paradox. There is rarely, if ever, a good
> > reason to use it with Fb/IB. For those who insist anyway,
> > TIBODataset's inherited RecordCount property resolves to a private
> > property RecordCountAll, whose read function constructs a select
> > count(*) query based on the set that was specified in the SQL
> > property. And of course, select count(*) isn't valid for a union.
> >
> > Helen