你看这样行吗?
CREATE TEMPORARY TABLE tmp
insert into tmp select a,sum(b) as c from table1 where e=tj1 group by a
select * from tmp where c=tj2
DROP TABLE tmp

解决方案 »

  1.   

    tmp是临时表,在内存中应该不慢
      

  2.   

    select * from (select a,sum(b) as c from table1 where e=tj1 group by a) where c=tj2分析:* 就是a,c,所以,可以如下:
    select a ,sum(b) as c from table1 where e=tj1 and c=tj2 order by c=tj3 group by a
      

  3.   

    在mysql4.0以前的版本不支持子查询。
    你可以用它实现!
    这是个模式,套用就可以了。
    select table1.* from table1 left join table2 on table1.column1 = table2.column2 where table2.column2 is null
      

  4.   

    select a ,sum(b) as c from table1 where e=tj1 and c=tj2  group by a