执行如下语句 update payment set end_date=date_add(end_date,interval 0 day)
where payment_id=(select payment_id from payment where date(now())>=date(begin_date)
and date(now())<=date(end_date)
and cust_id='0020001081100047'
and Operation_Type='1'); 老是报you can't specify target table 'payment' for update in from clause错误。为啥?
where payment_id=(select payment_id from payment where date(now())>=date(begin_date)
and date(now())<=date(end_date)
and cust_id='0020001081100047'
and Operation_Type='1'); 老是报you can't specify target table 'payment' for update in from clause错误。为啥?
解决方案 »
- MySQL table '库名.syscolumns' doesn't exist
- mysql 如何修复INNODB的表
- mysql 5.0 修改数据表字段报错
- 如何提高数据库存在更新、不存在插入的效率??
- load data infile
- MySql数据恢复
- MySQL的记录存储极限是多少
- 请问开服务器(带sql的)要不要再开一个sql2k?
- 招聘NT平台WEB开发程序员了解ASP.NET的开发,懂得C#,对数据库MSSQL有一定的了解。有一定的工作经验。工作地点在上海徐家汇试用期2个月具
- 哪里有很好的虚拟主机申请,支持jsp,servlet,mysql,xml,提供具体网址,有重分相赠。
- (求教,急~~~)一个表中,不同字段,相同的值,汇总的方法
- sql查询效率
on a.payment_id=b.payment_id
set end_date=date_add(end_date,interval 0 day)
where date(now())>=date(b.begin_date) and date(now()) <=date(b.end_date)
and b.cust_id='0020001081100047'
and b.Operation_Type='1'
错误的原因是you can't specify target table 'payment' for update in from clause
翻译如下,你应该就明白了,你不能指定目标表payment来使用from的更新条件
http://answers.google.com/answers/threadview?id=475696
on a.payment_id=b.payment_id
set a.end_date=date_add(a.end_date,interval 0 day)
where date(now())>=date(b.begin_date) and date(now()) <=date(b.end_date)
and b.cust_id='0020001081100047'
and b.Operation_Type='1'