How can I delete all duplicates keeping only 4 duplicates of that row?

Er Gagandeep Sethi

Below is the screenshot of having multiple versions of track with track_id=5. I want to retain 4 and remove all in Mysql.

image

The above screenshot shows many duplicate rows. Seeing track_id and artist_id as duplicate I want to keep 4 duplicates and to remove other duplicate rows for that record.

Gagzzz

Add this validation while saving records like below code:

$artist_q1 = $this->DbYtVideoVersions->find()->where(['track_name'=>$artist->track_match, 'artist_name'=>$artist->artist_match]);
                                                if($artist_q1->count()<4){
                                                $playlist_en = $this->DbYtVideoVersions->newEntity();  
                                                $this->DbYtVideoVersions->patchEntity($playlist_en, $trackData);
                                                $this->DbYtVideoVersions->save($playlist_en);
                                                }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to delete all lines that contain only duplicates characters?

From Dev

How do I delete all but duplicates from a list in prolog

From Dev

How can I query for duplicates?

From Dev

How I can get all combinations that have duplicates in Java (recursion)?

From Dev

How do I remove duplicates row in SQL?

From Dev

Merge duplicate rows and delete all duplicates after merging into one row

From Dev

How can we specify the unzip or 7za command in linux to extract multiple zip files into one folder while keeping all duplicates?

From Dev

PHP - Delete all duplicates in array

From Dev

How to delete duplicates and leave one row in a table - sql

From Dev

How can I delete duplicates in Oracle SQL, where a tuple is a duplicate if the same values are interchanged in columns?

From Dev

How can I delete duplicates in Oracle SQL, where a tuple is a duplicate if the same values are interchanged in columns?

From Dev

How can I delete duplicates group 3 columns using two criteria (first two columns)?

From Dev

How to select only distinct row when there might be duplicates using SQL?

From Dev

How Can I Merge All Duplicates In Array Based On One Key's Value?

From Dev

How do I view all duplicates across all rows?

From Dev

How to delete duplicates from an arraylist

From Dev

How to delete duplicates in line of text?

From Dev

Excel find duplicates, adding their values and delete row

From Dev

Count how many times a field shows up in a collection while keeping all data with no duplicates

From Dev

Keeping first instance of duplicates

From Dev

numerical sorting but keeping duplicates

From Dev

Drop duplicates keeping the row with the highest value in another column

From Dev

I have duplicates values in my database how to get only one

From Dev

JavaCC Beginner - How do I make the program only accept if there are no duplicates?

From Dev

Google Spreadsheet find duplicates and delete ALL

From Dev

Sum duplicate rows and then delete all duplicates

From Dev

Delete all duplicates in a bunch of .txt files

From Dev

Removing all duplicates from the list - keeping no instance of a duplicate item

From Dev

Having trouble keeping all variables after removing duplicates from a dataset

Related Related

  1. 1

    How to delete all lines that contain only duplicates characters?

  2. 2

    How do I delete all but duplicates from a list in prolog

  3. 3

    How can I query for duplicates?

  4. 4

    How I can get all combinations that have duplicates in Java (recursion)?

  5. 5

    How do I remove duplicates row in SQL?

  6. 6

    Merge duplicate rows and delete all duplicates after merging into one row

  7. 7

    How can we specify the unzip or 7za command in linux to extract multiple zip files into one folder while keeping all duplicates?

  8. 8

    PHP - Delete all duplicates in array

  9. 9

    How to delete duplicates and leave one row in a table - sql

  10. 10

    How can I delete duplicates in Oracle SQL, where a tuple is a duplicate if the same values are interchanged in columns?

  11. 11

    How can I delete duplicates in Oracle SQL, where a tuple is a duplicate if the same values are interchanged in columns?

  12. 12

    How can I delete duplicates group 3 columns using two criteria (first two columns)?

  13. 13

    How to select only distinct row when there might be duplicates using SQL?

  14. 14

    How Can I Merge All Duplicates In Array Based On One Key's Value?

  15. 15

    How do I view all duplicates across all rows?

  16. 16

    How to delete duplicates from an arraylist

  17. 17

    How to delete duplicates in line of text?

  18. 18

    Excel find duplicates, adding their values and delete row

  19. 19

    Count how many times a field shows up in a collection while keeping all data with no duplicates

  20. 20

    Keeping first instance of duplicates

  21. 21

    numerical sorting but keeping duplicates

  22. 22

    Drop duplicates keeping the row with the highest value in another column

  23. 23

    I have duplicates values in my database how to get only one

  24. 24

    JavaCC Beginner - How do I make the program only accept if there are no duplicates?

  25. 25

    Google Spreadsheet find duplicates and delete ALL

  26. 26

    Sum duplicate rows and then delete all duplicates

  27. 27

    Delete all duplicates in a bunch of .txt files

  28. 28

    Removing all duplicates from the list - keeping no instance of a duplicate item

  29. 29

    Having trouble keeping all variables after removing duplicates from a dataset

HotTag

Archive