回复:请教一个SQL QUERY的问题。谢谢!

select * from testtable group by dept_id order by salary limit 5

limit 5是mysql的语法

所有跟帖: 

Sorry about my incomplete info. I mean in oralce. Thank you for -小虾米- 给 小虾米 发送悄悄话 (0 bytes) () 07/20/2009 postreply 10:32:52

回复:Sorry about my incomplete info. I mean in oralce. Thank you f -小丹尼- 给 小丹尼 发送悄悄话 (91 bytes) () 07/20/2009 postreply 10:51:26

Thank you! I am reading some articles and they mentioned using R -小虾米- 给 小虾米 发送悄悄话 (0 bytes) () 07/20/2009 postreply 11:01:29

对不起,这个sql语句有些问题,你先不要用 -小丹尼- 给 小丹尼 发送悄悄话 (16 bytes) () 07/20/2009 postreply 11:01:10

不好意思,前面误人子弟了。需要用ORACLE的分组排序 -小丹尼- 给 小丹尼 发送悄悄话 (0 bytes) () 07/20/2009 postreply 11:21:08

I figured it out, but used long and repeated query. I don't know -小虾米- 给 小虾米 发送悄悄话 (63 bytes) () 07/20/2009 postreply 11:28:56

这个问题好像别人问过 -小丹尼- 给 小丹尼 发送悄悄话 (144 bytes) () 07/20/2009 postreply 11:43:06

看看这个方案 -小丹尼- 给 小丹尼 发送悄悄话 (1477 bytes) () 07/20/2009 postreply 11:46:26

You are awesome! I used RANK and make it work. THANK YOU! -小虾米- 给 小虾米 发送悄悄话 (0 bytes) () 07/20/2009 postreply 12:07:29

请您先登陆,再发跟帖!