fix select data by measurment id sql statement