0
我有一個表下面的結構和數據...選擇之上鮮明的結果,但返回的所有結果
email name address
[email protected] ab us
[email protected] de fr
[email protected] bv dc
[email protected] cd mm
[email protected] bv dc
[email protected] cd mm
我想基於之上的電子郵件,以顯示不同的行。例如,在上述情況下的結果應該是:
email name address
[email protected] ab us
[email protected] bv dc
[email protected] cd mm
[email protected] de fr
[email protected] bv dc
[email protected] cd mm
我使用下面的查詢,但只會讓我在不同的結果,我需要在上面
select ROW_NUMBER() OVER(PARTITION BY email ORDER BY email DESC) AS RowNumber, email, name address where RowNumber = 1
請提供您創建的查詢。 – Alex
我想你想使用row_number()(通過電子郵件順序分區)然後按順序排序? – ZLK
剛剛編輯的問題和使用的row_number,但如何使用順序,以獲得不同的結果頂部 – Anurag