0
我有一個包含「文件名」,「表名」,「項目」,「任務」,「所有者」,「小時」 「百分比」SQL根據多列刪除同一個表中的重複行
+---------+---------+--------+----------+-------+------+------------+
|fielname |sheetname|project | task | owner | hours|percentage |
+---------+---------+--------+----------+-------+------+-------------+
| file1 | IBM | Website | develop | sam | 5 |25
| file1 | IBM | website | test | sam | 7 |20
| file1 | IBM | support | design | ivan | 2 |7
| file1 | DELL | android | config | peter | 9 |30
| file2 | IBM | Website | develop | sam | 9 |45
| file2 | DELL | android | config | josef | 4 |50
| file2 | DELL | android | config | peter | 3 |70
| file2 | DELL | android | test | mark | 8 |70
| file2 | HP | webapp | code | jack | 10 |65
| file3 | IBM | website | test | sam | 7 |20
| file3 | HP | webapp | code | jack | 10 |65
| file4 | IBM | Website | develop | sam | 9 |45
我想刪除重複的行時SHEETNAME以及項目和任務,所有者和小時百分比爲2行之間的相同只是文件名是不同的,所以我們刪除第二行和我們保持第一行。
例如:
| file1 | IBM | Website | develop | sam | 5 |25
| file2 | IBM | Website | develop | sam | 9 |45
| file4 | IBM | Website | develop | sam | 9 |45
FIL1和file2有時間和百分比不同的值,所以我們把它。 文件2和文件4在其他列的值相同,所以我們刪除整個排在哪裏文件4
感謝你的幫助
PL/SQL或MySQL?請只使用一個數據庫標籤。 –
如何決定選擇哪一個? file1和file3例如 –
如果它是Oracle DB,則可以使用「ROW_NUMBER」或「DENSE_RANK」分析函數。 – AndrewMcCoist