-3

there is my code sample that deletes data from queue_db,I need code which inserts queue_db values to staff_db table.enter image description here

Gigz
  • 3
  • 1
  • Please go read [ask]. Code relevant to your problem, needs to be posted in text form, and properly formatted. Do not post _images of_ code. – CBroe Apr 02 '20 at 09:11

1 Answers1

0

You can use SQL query

Copy all record one table to another


 insert into staff_db select * from queue_db

This will transfer the data one table to another, later you can delete records conditionally from first table

If the columns names are different then

Copy all record one table to another with column name alias


 insert into staff_tb(column1, column2, column3) select c as column1, b as column2, d as column3 from queue_db

where c,b,d are the columns in the second table

If you want to filter it with condition then add where at the end of the query with <tablename.columnname> = <value>

Copy all record one table to another without duplicates


To prevent duplicates, you can use this answer Prevent Duplicate I don't want repeat the same answer here

If you want copy those data into fresh new table like doing a backup then

Copy all record one table to a fresh new table


 select * into newtable from queue_db

Then you run delete query for table which you copied from

Delete all records from a table


 delete from queue_db
Dickens A S
  • 3,824
  • 2
  • 22
  • 45