I have two tables (campaigns
and old_campaigns
) in a MySQL database.
Both tables have identical columns: id, user_id, url, ordered, sent, start_date, end_date
.
The columns ordered
and sent
are both integers. Here's what I want to do:
I want to check to see if the number in the sent
column is 1.25x higher than the number in the ordered
column. If it is, I want to move that row from that row from the campaigns
to old_campaigns
table.
For example, if ordered
was 100, then if sent
was 125+, that row should be moved.
I'm technically already doing this with PHP, I'm really just looking to see if there's a way to do this with pure MySQL and move all the rows at the same time, since my PHP script is currently having to loop through each row and check.