次のコードは、アラームアカウントごとに1つ以上のCust_Edit_Log.Edit_Timestampが存在する可能性があるため、複数の行を示しています。重複が発生する他の方法はありません。最も早いCust_Edit_Log.Edit_Timestamp日付でのみ結果を取得するにはどうすればよいですか?あなたが提供できるあらゆる助けをありがとうございます。 BY私のクエリで重複したエントリを削除するには?
Select
AR_Customer.Customer_Number As 'Customer_Number',
AR_Customer.Customer_Name As 'Customer_Name',
AR_Customer_System.Alarm_Account As 'Alarm_Account',
AR_Customer_Site.Address_1 As 'Site_Address_1',
Cust_Edit_Log.UserComments As 'Edit_Log_Cust_User_Comments',
Cust_Edit_Log.Edit_Timestamp As 'Edit_Log_Cust_Timestamp',
Cust_Edit_Log.UserCode As 'Edit_Log_Cust_User'
From
AR_Customer
Inner JOIN AR_Customer_Site On AR_Customer.Customer_Id = AR_Customer_Site.Customer_Id
Left Outer JOIN AR_Customer_System On AR_Customer_Site.Customer_Site_Id = AR_Customer_System.Customer_Site_Id
Left Outer Join CQB_Log_Parse Cust_Edit_Log on AR_Customer.Customer_Id = Cust_Edit_Log.Customer_Id
Where
AR_Customer.Customer_Id <> 1 And
(AR_Customer_System.Alarm_Account Like 'IN%' And
Cust_Edit_Log.UserComments Like 'Edited Customer System IN%')
Order By
AR_Customer.Customer_Number ASC
http://stackoverflow.com/questions/18932/how-can-i-remove-duplicate-rows?rq=1 – apomene
パーティション分割を使用する –