Replace jobs like insert, except that if there is a row with the same key that you are trying to insert, it will be deleted when replaced instead of giving you an error.
You can directly specify the arguments:
REPLACE INTO sales( `item_id`, `date`, `qty`, `price` ) VALUES( 15, '2012-01-01`, 5, '120.00' )
or specify them using SELECT:
REPLACE INTO sales( `item_id`, `date`, `qty`, `price` ) SELECT item_id, date, qty, price FROM sales_to_accept WHERE sales_id = 721
However, you cannot mix both types of syntax in a single query.
But there is nothing to prevent you from adding constant values โโas columns for SELECT:
REPLACE INTO sales( `item_id`, `date`, `qty`, `price` ) SELECT item_id, CURDATE(), 5, '74.00' FROM item WHERE `sku` = 'something'
piotrm
source share