求一个查询的写法,帮顶有份! http://community.csdn.net/Expert/topic/4161/4161213.xml?temp=.1366846你自己看看吧,再修改一下就行了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SQL> select * from aa; ID TESTID SCORE---------- ---------- ---------- 1 1 66 1 2 67 2 1 69 2 3 60 2 2 61 2 4 62 2 5 63 3 1 64 3 3 65 3 4 99 3 7 88已选择11行。select id, min(decode(1,latest_3,score,''))|| min(decode(2,latest_3,','||score,''))|| min(decode(3,latest_3,','||score,'')) result from (select id, score, row_number() over (partition by id order by testid desc nulls last) latest_3from aa )group by id ID RESULT---------- ------------------------------ 1 67,66 2 63,62,60 3 88,99,65SQL> ATGC(想到南极去看看飞翔的海鸥):多谢了,分组后用MIN函数这部分看不太懂。能否介绍一下思想? oracle 删除表问题 谁帮忙写个SQL语句 求一存储过程写法~~~~ 请教:在不安装ORACLE的情况下,如何执行ORACLE存储过程?? 请教下,这个逻辑怎么写好些? 如何切分字符串問題? 用c#程序时时从oacle倒到sqlserver2000里的数据为和出现乱码? 导出数据库的时候出现1466错误,请问怎么解决? Oracle怎么书写sql server中top 3之类的sql(就是成绩前三名的学生之类需求) 求问一个小白的问题 主键、外键的问题,求救 请大家看一下怎样写这个查询语句错在哪里?
---------- ---------- ----------
1 1 66
1 2 67
2 1 69
2 3 60
2 2 61
2 4 62
2 5 63
3 1 64
3 3 65
3 4 99
3 7 88已选择11行。select id,
min(decode(1,latest_3,score,''))||
min(decode(2,latest_3,','||score,''))||
min(decode(3,latest_3,','||score,'')) result from (
select id,
score,
row_number() over (partition by id order by testid desc nulls last) latest_3
from aa )
group by id ID RESULT
---------- ------------------------------
1 67,66
2 63,62,60
3 88,99,65SQL>
多谢了,分组后用MIN函数这部分看不太懂。能否介绍一下思想?