Question : Sybase Count Number by Group

Hi,

I am trying to run the following update statement in Sybase.  What i want to do is to update the count that is grouped by SERVERNAME and INSTANCE_NAME.  But the code returned an error on incorrect syntax near the keyword 'group'

update tempdb..ICG_ENGINES
set COUNT_TBLS_DBS =  count(distinct d.DbName)
from tempdb..DbSize_all d, tempdb..ICG_ENGINES i
where
upper(d.MachName) = i.SERVERNAME
and upper(d.SvrName) = i.INSTANCE_NAME
group by SERVERNAME, INSTANCE_NAME


Thanks,
Kaden

Answer : Sybase Count Number by Group

Reworking the query to:
update tempdb..ICG_ENGINES
set COUNT_TBLS_DBS = (
                 SELECT count(distinct d.DbName)
                 from tempdb..DbSize_all d
                 where upper(d.MachName) = tempdb..ICG_ENGINES.SERVERNAME
                 and upper(d.SvrName) = tempdb..ICG_ENGINES.INSTANCE_NAME
                 group by d.MachName, s.SrvName)
should work.
Random Solutions  
 
programming4us programming4us