Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formulas in mysql forms 1

Status
Not open for further replies.

compudude86

IS-IT--Management
Jun 1, 2006
46
hi all,
im migrating over from access to mysql, after finally figuring out access. i need to do a formula that automatically calculates two fields in a database and gives me a percentage. the formula is GPM=(srp-net)/srp . i got it to work, but its not doing it in order of operations. please help!!
 
ok, heres my query:

CREATE VIEW `book`.`view` AS
SELECT Description, Size, Pack, List, Net, Discount, NetBtl, SRP, Vendor, Date, (SRP*NetBtl) / SRP as GPM FROM products;


now, i want to make "SRP" as a percent, and my formula is (SRP*NetBtl)/SRP, but it wont do it parenthesis first,it just mashes them all together
 
ahh, thank you very much, i didnt catch that for some reason. now, is there a way to write in the query to make "GPM" a percent field? and how would i move the decimal?
 
that could work, but i want it to be a regular number, no decimal, and a percent sign, i used to be able to do it in access, but i have no clue how to do it in mysql.
 
thank you so much, thats exactly what i was looking for!!! just one more quick one, is there a way to shave the last two digits off a field, i.e i have the price field, and its coming up as 119.0000, and i want it to be 119.00. how do i apply that to each field?
 
now, i have to apply that to about 5 fields in the view, how would i put that into syntax?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top