select name ,max(price) 
from table_1 a,table_2 b
where a.table_1_id=b.table_1_id
group by name

解决方案 »

  1.   

    对了,差点忘了还有一点
    就是先按table_1_id ,排序然后按name排序。语句要怎样该
    select table_1_id ,name ,max(price) 
    from table_1 a,table_2 b
    where a.table_1_id=b.table_1_id
    group by table_1_id,name
    这么写对吗?
      

  2.   

    select table_1_id ,name ,max(price) 
    from table_1 a,table_2 b
    where a.table_1_id=b.table_1_id
    group by table_1_id,name
    order by table_1_id,name