SELECT max(weather_time) FROM pressure where (weather_time < '$event_time')
####
SELECT max(weather_time), baro_pressure FROM pressure where (weather_time < '$event_time')
####
SELECT weather_time, baro_pressure from pressure where weather_time = (select max(weather_time) FROM pressure where (weather_time < '$radar_time'))
####
my $sth = $dbh->prepare("SELECT max(weather_time) FROM pressure where (weather_time < '$data_time')")
or die "Cannot prepare: " . $dbh->errstr();
$sth->execute()
or die "Cannot execute: " . $sth->errstr();
my $row = $sth->fetchrow_hashref;
my $press_time = $row->{'weather_time'};
if (!defined $press_time) {
die "No pressure data earlier than the time of the data point ($data_time)"
};
$sth = $dbh->prepare("SELECT baro_pressure from pressure where (weather_time = '$press_time')")
or die "Cannot prepare: " . $dbh->errstr();
$sth->execute()
or die "Cannot execute: " . $sth->errstr();
$row = $sth->fetchrow_hashref;
$sth->finish();
return $row->{'baro_pressure'};