Subject Re: How to count the rows of a query result ?
Author Frank
--- In IBObjects@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
> I think something like
>
> select count(distinct v1.auto_id_customer)
> FROM V_TRANSACTIONS v1
> WHERE v1.INV_DATE > '01/01/2006'
> and (select sum(v2.UNIT_QTY*v2.UNIT_PRICE)
> FROM V_TRANSACTIONS v2
> where v2.auto_id_customer = v1.auto_id_customer
> and v2.INV_DATE > '01/01/2006') < 100000
>
> may be what you are looking for. Alternatively, the RowsSelected
> property of IBO returns the number of rows selected once you get to
the
> end of your result set (at least).

I tried this one already, but on a table with approx. 1000 records
it take more then 20 secs. - not really handy ....

Seems like Firebird does not support a
FROM (SELECT ....) or any other kind of virtual tables
besides of views - is this correct ?



> Though why is this number interesting to know?
I need a statistic of how many customers we have
within certain turnover-ranges


> Oh, and next time - ask such a question on the firebird-support
list
OK, noted

THX