按创建日期

时间:2015-11-10 09:19:23

标签: sql oracle

最简单的SQL语句是什么,它将返回给定列的重复值,例如ORDERS_NUMBERS,并将其按Oracle数据库表中最早的CREATION_DATE分组?

3 个答案:

答案 0 :(得分:1)

SELECT   ORDER_NUMBERS, count(*)
FROM     YourTableName
GROUP_BY ORDER_NUMBERS
HAVING   count(*) > 1
ORDER BY CREATION_DATE

答案 1 :(得分:0)

select ORDERS_NUMBERS,CREATION_DATE,count(*)
from
table
group by ORDERS_NUMBERS,CREATION_DATE
order by CREATION_DATE desc 
having count(*) > 1

答案 2 :(得分:0)

select 
t.orders_numbers, 
t.creation_date

from table t
group by t.orders_numbers, 
t.creation_date
having (count (*) >1)
;