So, I am a classically trained cabinet maker, there fore, I am a mysql hack. I have been hacking scripts for a couple of years now, but this one is stumping me. Please help. I am trying to write a trigger, update a row when a criteria is meet.
This one throws no errors, but no update
INSERT INTOstuff(orders_id,date_purchased,customers_company,order_total,customers_name)
SELECT zenoo_orders, orders_id,date_purchased,customers_company,order_total,customers_name FROM zenoo_orders
WHERE zenoo_orders.customers_id='stuff.customers_id'
this one errors
INSERT INTOstuff(orders_id,date_purchased,customers_company,order_total,customers_name)VALUES(NEW.orders_id,NEW.date_purchased,NEW.customers_company,NEW.order_total,NEW.customers_name)
SELECT zenoo_orders, orders_id,date_purchased,customers_company,order_total,customers_name FROM zenoo_orders
WHERE zenoo_orders.customers_id='stuff.customers_id'
This one writes a new row, but I need to update an existing
INSERT INTOstuff(orders_id,date_purchased,customers_company,order_total,customers_name)
VALUES(NEW.orders_id,NEW.date_purchased,NEW.customers_company,NEW.order_total,NEW.customers_name)
Any help would be much appriciated.