delete from DSBCRM..tsubmitedit where siteid=$siteid$ and tsubmiteditmodelid= $tsubmiteditmodelid$ and tenterprise_userid=$tenterprise_userid$



update tsubmiteditmodel
set frequireqty=t.fcount
from (
       select count(0) fcount from tsubmitedit where siteid =$siteid$ and tsubmiteditmodelid=$tsubmiteditmodelid$
     ) t
where tsubmiteditmodel.siteid =$siteid$ and tsubmiteditmodel.tsubmiteditmodelid=$tsubmiteditmodelid$