update的 update table_name set id=4 ,name='dadw' ,price=77 ,descp='cc' where id=select id from table_name where name='dadw';
id 是要通过后面一个select语句得到..是否语句写错了..都来赐教哦!!!!
id 是要通过后面一个select语句得到..是否语句写错了..都来赐教哦!!!!
select id from table_name where name='dadw'是否不只一条记录
UPDATE t ... WHERE col = (SELECT ... FROM t ...);
{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the FROM clause. Example: UPDATE t ... WHERE col = (SELECT ...from (SELECT ... FROM t...) AS _t ...);
出这样的错误 You can't specify target table 'table_name' for update in FROM clause
(select A.id from (select id,name from table_name) AS A where A.name='dadw');