Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
My Sql calculation query
Name: ian_ok Date: April 15, 2005 at 10:24:12 Pacific OS: win xp 98 & 2k CPU/Ram: p3 512
Comment:
I'm using MQ Sql to hold my data and now I wish to do a calculation with 1 field and return the value to another field:
Eg Field 1 = 100 Field 2 = Field 1 * 15.6
I can edit the Mqsql in php admin, would I just simply add Field 1 * 15.6 to field 1 or do i need to add brackets etc?
Name: Michael J (by mjdamato) Date: April 15, 2005 at 18:31:50 Pacific
Reply:
Is this a one-time update that you want to do to the entire database? I don't think you can do that through the MySQL admin - I could be wrong.
It would be pretty easy to write a PHP/ASP page to run once that would do it for you. Just do a select statement to return all records and then loop through all of them and update the new column.
Just a thought though, is this value ALWAYS going to be (Field 1 * 15.6) or can it change after you have made the update. If it will always be 15.6 times Field-1, then it would just make more sense to modify your code whenever you need that value instead of having two values int he database that might get out of sync.
Michael J
0
Response Number 2
Name: ian_ok Date: April 15, 2005 at 20:50:58 Pacific
Reply:
Field one is a price, field two will always be the value of field one times by 15.6 (well 166.386 the old Spanish peseta)
Summary: Hi everyone, I'm modifying my phpBB installation, and I need help with one of the queries I'm trying to modify. I'm a novice with SQL, so go easy, please! I'm changing the viewforum.php file, which i...
Summary: i am having trouble comin to grasps with this $sql = "SELECT * FROM sparesale WHERE spareid='$saleid'"; $query = mysql_query($sql) or die("Cannot query the database. " . mysql_error()); while($result ...
Summary: I'm using java as my prog. language I have problem delete a row in the database This is my sql statement. Whats wrong with it?It deletes all entry in the field rather than only the row i wanted it to ...