select id, parent_id from jj_sort where id not in ( select parent_id from jj_sort ) and channel=2;
这样可正常显示数据出来update jj_sort set groups='0' where id not in ( select parent_id from jj_sort ) and channel=2;
这样却提示错误如下:
错误代码: 1093
You can't specify target table 'jj_sort' for update in FROM clause
(耗费 0 ms)请问怎么解决?
这样可正常显示数据出来update jj_sort set groups='0' where id not in ( select parent_id from jj_sort ) and channel=2;
这样却提示错误如下:
错误代码: 1093
You can't specify target table 'jj_sort' for update in FROM clause
(耗费 0 ms)请问怎么解决?
解决方案 »
- 存储过程,急
- solaris 64位 与32位的 mysql链接问题
- 50在线求数据的查询合并插入问题
- 关于数据库索引的问题
- 求救select
- 查找多个表中同一字段相同值的情况 SQL怎么写?
- 关于sql语句数据库自动优化:where id=1 AND abc=xxx 和where abc=xxx AND id=1 哪一个快?还是一样快?id有索引,abc没有.
- 一次执行多个sql语句,可以实现吗,我的为什么不行.
- 在mysql中如何让password字段不显示明文?
- 如何把一张表的数据分布到不同的服务器上?
- Linux(ubuntu)如何在mysql5.1里设置Lock wait timeout默认时间
- 怎样将新的行或列添另到指定的位置
and channel=2;
create temporary table tmp select parent_id from jj_sort;
update jj_sort a,tmp b set a.groups='0' where a.channel=2 and a.id != b.parent_id;