select A.a1, count(*) from A,B where A.a1 = B.b2 group by A.a1
union
select A.a1, count(*) from A,C where A.a1 = C.c3 group by A.a1

解决方案 »

  1.   

    我现在用的mysql不支持union。我现在的工作是做数据库移植,不能换成其他版本的mysql。而且好像4.1的mysql也不支持uinon吧。只是支持子查询了。
      

  2.   

    4.1 support union.. if you could not use union, you have to 
    use temp table or multiple mysql statements..
      

  3.   

    UNION 在 MySQL 4.0.0 中被实现。
      

  4.   

    难道一个sql文真的无法解决?
      

  5.   

    i hope you could.. i ever spent a week to look for
    the solution without using "union" some months ago. 
    my model was even complicate then yours because single
    temp table is not enough. therefore i have to create
    a permanent "temp" table to replace the function of
    union. so, i assume there are no other ways..