I’m using a mysql database, and I’m trying to insert a record into tableB if the product code already exists in tableA.
I think a CASE statement would work, but I can’t find any further help on the web.
Here is what I have so far:
CASE (SELECT COUNT(*) FROM tableA WHERE tableA.item_code = '$pcode') > 1
THEN INSERT INTO tableB(item_id, serial_number, used)
VALUES ('$iid','$sns','$used') END
Any help greatly appreciated.
Cheers
You just need to write a regular old insert statement: