We have a data set where some measurements (of type float) can be out of range, showing ##### from time to time. We have therefore included a BIT flag (default 0) to identify when a measurement is out of range. When querying our data set, we have used CASE WHEN condition and return -99999 when out of range is 1 which we can then use to recreate these out of range symbols in our front end web app:
SELECT s.Name,CASE WHEN ge.OutOfRangeCH4 = 1
THEN -99999
ELSE ge.CH4
END AS 'CH4',
CASE WHEN ge.OutOfRangeCO2 = 1
THEN -99999
ELSE ge.CO2
END AS 'CO2',
CASE WHEN ge.OutOfRangeO2 = 1
THEN -99999
ELSE ge.O2
FROM ....
We have noticed on a large data set that the performance of this is not very good. Is there a better way to do this?
- Edited by DarrenOD 19 hours 41 minutes ago