I have two columns in my MySQL table total
and dollars
. I need to convert my dollars into rupees and store it in my total
field. Can I multiply live dollar rates and store the result?
I need a SQL query for a mathematical function which is like this:
total = dollars * current_dollar_rate_in_rupees
Can I make this conversion dynamic? If so how and what would be my SQL query?
您可以使用此查询将转换结果存储到total
字段中:
UPDATE `tablename` SET `total` = `dollars` * <current_dollar_rate_in_rupees>;
Multiplying Two Columns in SQL Server
So just store the value that is giving by this query in your database as 'total'
SELECT dollars * current_dollar_rate_in_rupees from tablename
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.