update c_visitor set pv_num=pv_num+1
where id=(select max(id)
from c_visitor
where c_info_id =1
and curUrl='http://127.0.0.1:8081/hboys');
我想更新c_visitor,根据 c_info_id =1 and curUrl='http://127.0.0.1:8081/hboys' 的条件,可是报错
you can't specify target table 'c_visitor; for update in from clause如果我单独执行,是可以的
但是我想合并到一起
不知道怎么办
请各位高手指点
where id=(select max(id)
from c_visitor
where c_info_id =1
and curUrl='http://127.0.0.1:8081/hboys');
我想更新c_visitor,根据 c_info_id =1 and curUrl='http://127.0.0.1:8081/hboys' 的条件,可是报错
you can't specify target table 'c_visitor; for update in from clause如果我单独执行,是可以的
但是我想合并到一起
不知道怎么办
请各位高手指点
where id=(select max(id)
from c_visitor
where c_info_id =1
and curUrl='http://127.0.0.1:8081/hboys');----------------------------------------------语法没有问题。
you can't specify target table 'c_visitor; for update in from clause
当在进行更新的时候,表就被锁定这时是不允许进读取操作的.而你在子查询与更新表使用的是同一个表,所以出了问题.所以只能分开写了,max(id)存在一个变量里,然后再进行更新,或者想其它的办法
郁闷,那位仁兄给予指点!!!!