-1

My Problem: I have got two MySQL tables. One table is called txns and another table is called archived_txns. Both of the tables has same columns. I use archived_txns to move data from txns using a PHP script.

I want to know how can I find out and delete the duplicate rows within these two tables. I am adding the Table structure for better reference.

This is the archived_txns table

enter image description here

This is the txns table

enter image description here

As stated in this example, I want to find out and delete the row with ID 3 from the txns table.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Souvik
  • 131
  • 1
  • 8

1 Answers1

1

You can delete it using JOIN

DELETE t 
FROM txns t
JOIN archived_txns a ON t.id = a.id
Samir Selia
  • 7,007
  • 2
  • 11
  • 30