SELECT bpu.id, bpu.useForm, pus.checkoutNumber, pus.quitNumber FROM
bigpartuse bpu
INNER JOIN (SELECT SUM(pu.checkoutNumber) checkoutNumber,SUM(pu.quitNumber)quitNumber, pu.bigId FROM partuse pu GROUP BY pu.bigId)pus
ON pus.bigId =bpu.`id`
WHERE  bpu.pastureId=304 
and bpu.`useForm` LIKE CONCAT('%','CK19220907007','%') 
-- AND bpu.`useType` <>4 AND pus.quitNumber < pus.checkoutNumber
ORDER BY bpu.`useForm`  desc

select * from  bigpartuse where useForm ='CK19220907007'