Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code for replacing and deleting data from MySQL db
#1
Hello everybody.
I have a problem. In my database I need to delete special rows of duplicated contractors from "contractors" table. Last (which always have the same individual vat_number) added duplicated contractor must only stay. Any other rows with duplicated contractor_id are to delete.
Second thing is that this old contractors (contractor_id) are in invoices in the second table "orders". I need a script to connect to mysql database and find all invoices having old contractor id and replace it all to last created contractor_id with the same vat_number.
Can somebody help me with this?

Here's the example:
[Image: mysql_tables.jpg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)