select 表1.id, 表1.name ,max(表2.h) from where 表1.id=表2.id group by 表2.h

解决方案 »

  1.   

    我觉得应该是这样
    select 表1.id, 表1.name ,max(表2.h) from where 表1.id=表2.id group by 表1.id, 表1.name
      

  2.   

    select id,name,(select max(h) from 表2 where id=表1.id) h from 表1
      

  3.   

    select t1.id,t1.name,t2.max_h from 表1 t1,select max(h) max_h from 表2 group by id) t2 where t1.id=t2.id;
      

  4.   

    sorry
    select t1.id,t1.name,t2.max_h from 表1 t1,(select id,max(h) max_h from 表2 group by id) t2 where t1.id=t2.id;
      

  5.   

    楼上丢as 了
    select t1.id,t1.name,t2.max_h from 表1 t1,(select id,max(h) as max_h from 表2 group by id) t2 where t1.id=t2.id;
      

  6.   

    不好意思,我想错了,上二楼的是对的,没有as
    select t1.id,t1.name,t2.max_h from 表1 t1,(select id,max(h) max_h from 表2 group by id) t2 where t1.id=t2.id;