我有一個oracle表,沒有任何pk設置爲其他一些原因。它有5列,我希望能夠刪除重複的記錄(如果5列值是相同的,它們是重複的)。我想出了這個SQL,但看起來這不是拿起重複值:從oracle表中選擇重複值
SELECT DATE_TIME, SITE, RESPONSE_TIME, AVAIL_PERCENT, AGENT
FROM table_name
GROUP BY DATE_TIME, SITE, RESPONSE_TIME, AVAIL_PERCENT, AGENT
HAVING COUNT(*) > 1
樣本記錄:
DATE_TIME SITE RESPONSE_TIME AVAIL_PERCENT AGENT
20-Apr-13 04.23.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 8.2610 100.00 45693
20-Apr-13 10.23.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 6.2900 100.00 45693
24-Apr-13 07.22.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.7300 100.00 45693
24-Apr-13 03.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.7180 100.00 45693
08-May-13 06.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.5970 100.00 45693
20-May-13 01.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.7910 100.00 45693
25-Apr-13 01.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.3400 100.00 45693
08-May-13 05.22.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 2.4410 100.00 45693
09-May-13 01.22.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 45693
21-May-13 06.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.5480 100.00 45693
23-Apr-13 02.23.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 10.7070 100.00 45693
26-Apr-13 09.22.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 4.0070 100.00 45693
26-Apr-13 03.52.00.00 AM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 3.9350 100.00 45693
22-May-13 12.52.00.00 PM Live Site (TxP)[IE]-Online Home Page - User Time (seconds)[Geo Mean] 4.1760 100.00 45693
23-Apr-13 02.53.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 6.9500 100.00 45693
23-Apr-13 03.23.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 6.0480 100.00 45693
23-Apr-13 04.23.00.00 AM Live Site (TxP)[IE]-Logon To My Accounts - User Time (seconds)[Geo Mean] 6.7600 100.00 45693
任何想法?
你能給樣本記錄嗎? –
你的sql看起來是正確的...你確定時間和所有的領域是完全重複的嗎? – sgeddes
@sgeddes,當我運行上面的SQL,我得到了sampe輸出。它們不是重複的,所有的值都是不同的。 – user1471980