Updated sql query in readSensors