begin declare sum int(0); select count(*) into sum from bm51 where bzz='0'; if (sum<20) then UPDATE bm51 SET bzz='0'; end if; end