SET @ids=ids;
SET @sel1='select HOUR(DateTime) Time,COUNT(HOUR(DateTime)) Num from shakerecord where TO_DAYS(NOW())-TO_DAYS(DateTime)<1 and adid in (';
SET @sel2=') GROUP BY HOUR(DateTime)';
set @sentence = concat(@sel1,@ids,@sel2);
prepare stmt from @sentence;
execute stmt;
deallocate prepare stmt; -- 释放资源
SET @sel1='select HOUR(DateTime) Time,COUNT(HOUR(DateTime)) Num from shakerecord where TO_DAYS(NOW())-TO_DAYS(DateTime)<1 and adid in (';
SET @sel2=') GROUP BY HOUR(DateTime)';
set @sentence = concat(@sel1,@ids,@sel2);
prepare stmt from @sentence;
execute stmt;
deallocate prepare stmt; -- 释放资源