赞
踩
以thinkphp3 执行原生sql为例 列:把id为2的等级改为3 把id为3的等级改为4 等 $upgradeUpdateSql .= ' when id='.2.' then '.3; $upgradeUpdateSql .= ' when id='.3.' then '.4; $updateSqlRes = 'update ln_user_cutepets set level = case '.$upgradeUpdateSql.' end where id in ('2,3')'; $res = M()->execute($updateSqlRes); 列:把id为2的等级加3 把id为3的等级加4 等 $upgradeUpdateSql .= ' when id='.2.' then level+'.3; $upgradeUpdateSql .= ' when id='.3.' then level+'.4; //下面的结果就是原生的mysql语句 $updateSqlRes = 'update ln_user_cutepets set level = case '.$upgradeUpdateSql.' end where id in ('2,3')'; $res = M()->execute($updateSqlRes);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。