40分 。求一条select 语句 ,马上结贴

40分 。求一条select 语句 ,在线等马上结贴idtypeval1132143154165246257268349351036这样的数据,我想按typ

40分 。求一条select 语句 ,在线等马上结贴
id               type           val
113
214
315
416
524
625
726
834
935
1036

这样的数据,我想按type   聚合   查出val最大的那个id  
也就是   id=4,7,10

请问这样的sql   应该怎么写。



[解决办法]
id type val
113
214
315
416
524
625
726
834
935
1036

这样的数据,我想按type 聚合 查出val最大的那个id
也就是 id=4,7,10

select * from t a
where val=(select max( val) from t where a.type=type)