update tb_lawcategory set num=
(select count(*) as count from tb_Lawyer_User where Goodat like' % '+@good+' %') where AreaName=@good
(select count(*) as count from tb_Lawyer_User where Goodat like' % '+@good+' %') where AreaName=@good
CREATE PROCEDURE sp_NewGoodLawyer
as
begin DECLARE cur CURSOR FOR select AreaName from tb_Lawcategory where ParentID <>0 DECLARE @good nvarchar OPEN cur
FETCH NEXT FROM cur INTO @good while @@fetch_status=0
BEGIN
update tb_lawcategory
set num=(select count(*) as count from tb_Lawyer_User where Goodat like '%'+@good+'%')
where AreaName=@good
FETCH NEXT FROM cur INTO @good
END CLOSE cur
DEALLOCATE cur
end
GO
as
begin DECLARE cur CURSOR FOR select AreaName from tb_Lawcategory where ParentID <>0 DECLARE @good nvarchar OPEN cur
FETCH NEXT FROM cur INTO @good while @@fetch_status=0
BEGIN
update tb_lawcategory set num=
(select count(*) as count from tb_Lawyer_User where Goodat like '%'+@good+'%') where AreaName=@good
FETCH NEXT FROM cur INTO @good
END CLOSE cur
DEALLOCATE cur
end
GO
update tb_lawcategory
set num=(select count(*) as count from tb_Lawyer_User where Goodat like '%'+tb_lawcategory.AreaName+'%')
as
begin update tb_lawcategory set num=
(select count(*) as count from tb_Lawyer_User where Goodat like '%'+ a.AreaName +'%')
where ParentID <>0
end
GO
update tb_lawcategory
set num=(select count(*) as count from tb_Lawyer_User where Goodat like '%'+tb_lawcategory.AreaName+'%')
where ParentID <>0