wwwwb,WWWWA你们看看这个情况 存储过程: BEGIN declare countj int; SELECT COUNT(serverid) INTO countj FROM `count_serverinfo` WHERE gameid = temgameid ORDER BY serverid,days; BEGIN INSERT into daydate(game1,serverorder,serverid,days) SELECT game,serverorder,serverid,MAX(IF(days=temdays,amountcount,0.00)) AS days FROM count_serverinfo GROUP BY serverid ORDER BY serverid DESC; END; END
php文件中的代码: $day = $db->query("SELECT days FROM `count_serverinfo` WHERE gameid = '1' GROUP BY days asc "); foreach($day as $key=>$days){ $db->getAll("set @temgameid='1',@temdays='".$days['days']."'"); $sql="call dier(@temgameid,@temdays)"; $db->getAll($sql); }