Subject | Re: [IBO] Trouble with Count(*) |
---|---|
Author | Helen Borrie |
Post date | 2004-04-14T14:17:08Z |
At 10:05 AM 14/04/2004 -0400, you wrote:
I won't go into the details of your code (it's a bit of a minefield).
If you *must* count records (why?????) do it with a TIB_DSQL.
The statement you want is
SELECT COUNT(*) FROM ATABLE as NumberOfRows
WHERE <WHATEVER>
Assign the SQL to the TIB_DSQL, Prepare, Execute; then read
Fields[0].AsInteger or Field['NumberOfRows'].AsInteger
Helen
>Hi,ESQL syntax - not applicable to DSQL (dynamic SQL - the one we use)
>
>I am a bit of a neophyte with SQL ...
>
>I am trying to get the count for a number of records matching certain
>criteria.
>
>I looked in the LANGREF.PDF that comes with and the syntax shows either:
>
>SELECT COUNT(*) INTO :field FROM TABLE WHERE condition;
I won't go into the details of your code (it's a bit of a minefield).
If you *must* count records (why?????) do it with a TIB_DSQL.
The statement you want is
SELECT COUNT(*) FROM ATABLE as NumberOfRows
WHERE <WHATEVER>
Assign the SQL to the TIB_DSQL, Prepare, Execute; then read
Fields[0].AsInteger or Field['NumberOfRows'].AsInteger
Helen