select min(date),no , Q FROM test group by no,q
解决方案 »
- pl/sql如何更改序列的名字
- Oracle sql 解析
- 这个JOB如何执行
- ORA-00600: internal error code, arguments: [KGHALP1], [0x0], [], [], [], [], [], []错误
- ORACLE表空间问题求助
- 将数据从Oracle移到SQL2000的问题
- 获得某个用户下所有表的schema
- oracle 哪种数据类型适合于asp网页的新闻内容字段,需要至少能容纳10000以上的字符?
- 关于序列的简单问题
- 紧急问题。请教!谢谢。
- 用SQL怎么查一段时间内的数据,比如:2004-05至2004-09月的数据,date类型不能用<或>的,该用什么判断啊??
- ■■■■■■■■一个超级复杂的SQL语句,请问如何优化精简为简单一些的句子?■■■■■■■■■■
min(a.DATE) as DATE,
a.NO,
a.Q
from
test a
where
not exists(select * from test where DATE>=a.DATE and NO=a.NO and Q<>a.Q)
group by
a.NO,a.Q
2 select to_char(date1,'yyyy/mm/dd') "date",no,q,
3 row_number() over(partition by no order by date1 desc) rn1
4 from
5 (select t.*,row_number() over(partition by no,q order by date1) rn
6 from test t
7 ) where rn = 1
8 ) where rn1 = 1
9 /date NO Q RN1
---------- ---------- ---------- ----------
2005/07/16 001 7 1
2005/07/17 002 6 1
2005/07/17 003 2 1
2 select to_char(date1,'yyyy/mm/dd') "date",no,q,
3 row_number() over(partition by no order by date1 desc) rn1
4 from (select min(date1) date1,no ,Q FROM test group by no,q)
5 ) where rn1 = 1
6 /date NO Q RN1
---------- ---------- ---------- ----------
2005/07/16 001 7 1
2005/07/17 002 6 1
2005/07/17 003 2 1
select min(date),no , Q FROM test group by no,q==>select max(date),no , Q FROM test group by no,q