!/bin/bash

start=6800000
j=19
for ((i=1;i<=j;i++))
do

end=expr $start + 1400000

if (( $end > 32862620 ))
then
end=32862620
fi
sql="delete from mmststdb.task where CREATETIME<'2021-05-01 00:00:00' and id>$start and id <$end;"
/apps/mysql5.7.30/bin/mysql -u root -h IP -ppwsswd -P port dbname -N -e ${sql}

start=$end
done