How you would go about writing a script that calculates the percent change between two values and then submit the results in to a new MYSQL table?
How you would go about writing a script that calculates the percent change between
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do it in a simple SQL query without needing to do anything in PHP at all:
Assumes table to be inserted into is called
newTableand has two columns (IDwhich is auto_increment andpercywhich is the percentage value ofcol1/col2from table2):Or if you want to get the ID (called myID) of the original row and insert the calculated percentage into the new table: