我有一張表,里面有號碼,時間,以及其他的一些欄位,我想根據號碼刪重,取號碼出現時間最大的一整條記錄,distinct和max的組合好像只能取兩個欄位,其他的欄位取不出來,想請教下大神這個sql陳述句要怎么寫。
uj5u.com熱心網友回復:
row_number()over(partition by 號碼 order by 時間 desc) rn查詢的時候使用rn=1,問題就解決了。
uj5u.com熱心網友回復:
delete from table where rowid not in (select max(rowid) from table group by 手機)uj5u.com熱心網友回復:
select *
from tab_phone_test t
where t.phone_time in (select max(t1.phone_time)
from tab_phone_test t1
group by t1.phone_num)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/80584.html
標籤:開發
上一篇:oracle 多欄位匹配問題
