MySQL does not allow you to run select while updating a table
The work und is to generate a temporary table from a derived table. In this way, both update and select
Update tb_trade_1 inner join (select tid, count (*) as CNT from tb_order_1 group by TID) as der using (TID) set commission_limit = der. CNT;
Remove duplicate data in MySQL
In general, the SQL statement should be:
Delete tablename where id not in (select Min (ID) from tablename group by name, kecheng, fenshu );
This method is supported in sqlserver or Oracle, but MySQL does not currently support it. An error similar to the following is reported: You can't specify target table 'tablename' for update, this is because MySQL cannot query the data of a table at the same time and then delete it at the same time.
Delete A. * From tb_trade_0 as A, (select tid, count (*), min (ID) as ID from tb_trade_0
Group by TID having count (*)> 1 order by gmt_create DESC) as B
Where a. tid = B. TID and A. ID> B. ID;
Delete. * From 'sites _ Cates 'as a left join 'sites' as B on 'A '. 'site _ id' = 'B '. 'sid 'where' B '. 'name' is null is not simple. The difference between MySQL and Oracle is that MySQL cannot use the table in the clause, but oracle can, this is one of the differences between MySQL and Oracle SQL.