SQL code for old weather station