即使用UNION好像也不能用一条语句实现,不过我没试过,也许配合 DISTINCT可行。。

解决方案 »

  1.   

    mysql 4.1 就支持子查询了。
      

  2.   

    用union 只能取 id 不能取val, 郁闷~~~~~~
      

  3.   

    select distinct id, val from (select * from t1 union select * from t2 union select * from t3) as tt group by id;mysql >= 4.1
      

  4.   

    原来mysql不支持这么重要的功能
      

  5.   

    明知不可为而为之,这并不是做学问应有的态度create temporary table tmp select * from t1
    union
    select * from t2
    union
    select * from t3;select * from tmp group by id;mysql4.0.1通过
      

  6.   

    建议把MYSQL升一下级吧。也不麻烦。
      

  7.   

    xuzuning(唠叨) 
    明知不可为而为之,这并不是做学问应有的态度说得好, 谢谢 :)