Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Please help me to solve my problem related to duplicate rows in mysql through php code.

i have table with four column. in which we need to check three column for uniqueness (A, B, C). D will not take part in checking of duplicate rows

for e.g.

A     B    C    D
1     2    3    1
1     2    3    3
1     3    2    3
2     3    1    2

i want to delete duplicate rows from table and insert it to another table. so we left unique rows in our table.

table will be 

A B C D
1 3 2 3
2 3 1 2

another table will be 
A B C D
1 2 3 1
1 2 3 3
Posted
Comments
W Balboos, GHB 28-Dec-15 9:21am    
Please explain where you need help - what have you done?
harry_rana 28-Dec-15 9:29am    
i have find the duplicate rows and merge all duplicates into single unique rows. but in that case we have to move all duplicate rows into another table without leaving any duplicate rows in previous table
[no name] 28-Dec-15 10:22am    
How is about to check first for creating duplicate in the "first" table before INSERT/UPDATE the data? And in case you recognize duplicates move the one from "first" to "scnd" table and insert also new one directly to "scnd" table? Of course all this inside a Transaction.... or if possible (I mean mySQL supports it), handle all this with a Trigger for "first" table.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900