How to convert units of various types then average the results

35 Views Asked by At

I have a table that has various torque values in units of imperial and metric. I would like to convert the metric values into imperial and then average all values as a total average with the imperial result. How do I convert each row into the same unit and then run the average in one query? The units are sent as a string.

I am using MySql

to convert NM to FtLbs

Imperial = NMtorque x 0.73756

The result should be from all rows of average Torque in imperial units

SELECT avg(torque) as avg from TorqueTestResults

ID  TORQUE UNITS
===================
1   100       Lb.ft
2   120       Lb.ft
3   135       N.m
4   140       N.m
0

There are 0 best solutions below