If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I would like to add a new column to a table that takes the information from another column and subtracts 10% from that number. The following is what I have so far. I don't know how to complete the trigger statement to set the information from the other row. Additionally, I want to make the default value of the new column pListPrice -10%. Any ideas would be much appreciated! Thanks!
ALTER TABLE products ADD a_price DOUBLE DEFAULT (SELECT pListPrice *.9 FROM products);
CREATE TRIGGER t_products BEFORE UPDATE ON products FOR EACH ROW SET a_price = pListPrice*.9