回複:請教一個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

請您先登陸,再發跟帖!