mysql - How to update a field in table withrepect to the data in another table Coloumn using Trigger -
i have 2 tables namely enquiry_details , customer_details, if customer name enquiry_details table in customer_details table need update enquiry_details table status of existing customer field yes otherwise no.
this should done using trigger. kindly trigger code.
thanks, acube.
create trigger track_customer before insert on enquiry_details each row begin if (select count(*) customer_details customer_name = new.customer_name) <= 0 set new.existing_customer = 'no'; else set new.existing_customer = 'yes'; end if; end;//
Comments
Post a Comment