RE: Count(*) with additional query
Posted in 2000
> I would like to count rows when I do a select
> statement for specific columns, but count(*) does
> not like that:
>
> select count(*),
> propertyname,
> objectid
> from properties
> where propertyname='SITENAME'>
> I would prefer not to, but do I have to put these
> into separate select statements?
>
> select count(*)
> from properties
> where propertyname='SITENAME'>
> select propertyname,
> objectid
> from properties
> where propertyname='SITENAME'
With my reputation in this field I definitely
should not answer this !!!!
Anyway I think that you will need 2 selects. The first being
select propertyname, objectid
from properties
where propertyname='SITENAME'
The second being
SELECT FIRST 1 DBINFO('sqlca.sqlerrd2')
FROM systables -- ??? any table
or at least something along those lines.
If using 4gl or the like it may be slightly easier.
Jo
___________________________________________________________________________
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
Sema Group.
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited.
If you have received this email in error please notify the Sema Group
Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________