Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO `purchase`
- SET `product_id` = $whatever,
- `price` = (
- SELECT `price`
- FROM `product`
- WHERE `id` = $whatever
- )
- INSERT INTO purchases (
- price
- ,productid
- ,add your other columns here
- )
- SELECT price
- ,id
- ,add your other columns here
- FROM products
- WHERE add your selection criteria here
- insert into purchases(purchase_id, product_id, price)
- select 88, product_id, current_price from product
- where product_id = 'KEYB'
- insert into purchases(purchase_id, product_id, price, discount)
- select 88, product_id, current_price, current_discount from product
- where product_id = 'KEYB'
Add Comment
Please, Sign In to add comment