当有子查询时,不要使用计算列,子查询里面或者外面加了 a=1 条件结果不同
    drop table if exists ttt;
    create TEMPORARY table ttt(a int ,b int,c int);
    insert into ttt
    select 1,2,0;
    drop table if exists aaa;
    create TEMPORARY table aaa(a int ,b int,c int);
    insert into aaa
    select 1,2,0;
    update ttt inner join ( select from (select a,sum(b) as b from aaa where a=1 group by a) t1 ) t on ttt.a = t.a
    set ttt.b = t.b + 3 ,ttt.c=round(ttt.b,0)+3;
    select
    from ttt;