请教SQL语句的语法问题,高手帮忙
Sql = "Update EgeWst a set ItemType= 'OTHER ' where sonnum> 0 and (select count(*) as rsnum from EgeWst where ParentId=a.ItemId and ItemType= 'INFO ')=0 and ItemType= 'INFO ' "
Sql = "select ItemId,Manage_Title,ParentId from (select ItemId,Manage_Title,ParentId from EGeWst a where (SonNum> 0 and (select count(id) as rsnum from EgeWst where ParentId=a.ItemId and SonNum=0)> 0)) order by ItemId "
上面这两句是ACCESS下的语句,现在数据库换成SQL server2000了,报错了, 'a ' 附近有语法错误。
请教高手,我应该怎么改
[解决办法]
Update a set ItemType= 'OTHER '
from EgeWst
where sonnum> 0 and
(
select count(*) as rsnum
from EgeWst
where ParentId=a.ItemId and ItemType= 'INFO '
)=0
and ItemType= 'INFO '
select ItemId,Manage_Title,ParentId
from
(
select ItemId,Manage_Title,ParentId
from EGeWst a
where
(SonNum> 0 and (select count(id) as rsnum from EgeWst where ParentId=a.ItemId and SonNum=0)> 0)
) a
order by ItemId