I need to update my current code to convert a reading value (from table 'VisionReadings') from one unit to another. The intention here is to process this one source unit at a time.
I need something for each ReadingsId;
if SourceUnit = 'Unit' and DestinationUnit ='Unit' and 'date' between ValidFrom and ValidTo then ConversionFactor * ReadingValue
(e.g.
ReadingsId = '206742720'
SourceUnit = 'kWh'
DestinationUnit = 'tCO2'
date = '01/05/2017'
then (readingValue) 344.3 * (ConversionFactor) 0.00018381 = 0.063286
My current code (below) is based on @MarcoWedel 's answer to the following query