$result=mysql_query("select table1.pid from table1,table2 where table1.pid=table2.pid ");//查询所有要修改的记录 while($row = mysql_fetch_row($result)){ mysql_query("update table1 set sum=sum-1 where pid='$row[0]'");//修改 } 你的update语句过不了啊,update 不用from update tablename set propertyname=somevalue where ……
where table1.pid=table2.pid ");//查询所有要修改的记录
while($row = mysql_fetch_row($result)){
mysql_query("update table1 set sum=sum-1 where pid='$row[0]'");//修改
}
你的update语句过不了啊,update 不用from
update tablename set propertyname=somevalue where ……
我在MYSQL中试过,语句执行没有问题,可就是结果不改变!可能跟MYSQL
也有关系的吧.在MSSQL中是可以的,真见鬼!
写复杂了自己以后也难看懂啊 ~
这和intel使用精简指令系统一样道理,比如做乘法运算,用一条复杂指令需50个机器周期,用5条简单指令可能只需40周期
肤浅之见,呵呵