loading_tracking_id | loading_id | loading_num | time | event | name | name_en |
---|---|---|---|---|---|---|
3830640 | 111111 | 105416102020 | 2021-07-01 01:59:00 | office | London | UK |
3830641 | 22222 | 402055656444 | 2022-03-02 08:02:13 | courier | Paris | FR |
3830642 | 111111 | 105416102020 | 2021-07-01 01:59:00 | office | London | UK |
3830643 | 111111 | 105416102020 | 2021-07-01 01:59:00 | office | London | UK |
3830644 | 111111 | 105416102020 | 2021-07-01 01:59:00 | office | London | UK |
3830645 | 111111 | 105416102020 | 2021-07-01 01:59:00 | office | London | UK |
I have almost no SQL knowledge and need help. I have a database table from which I want to delete duplicates, leaving only one result (no matter the first or the last)
I need to delete all dupications where column "loading_id" has the same data for loading_num, time, event and name. I want to delete all duplications and keep just one of them.
Server version: 10.3.37-MariaDB - MariaDB Server
no skills to be able to test any sql code
DELETE FROM MariaDB
WHERE loading_tracking_id NOT IN
(
SELECT MAX(loading_tracking_id) FROM MariaDB
GROUP BY loading_id, loading_num, time, event, name, name_en
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.