I need to execute an INSERT...SELECT query.
INSERT HIGH_PRIORITY INTO stations_data
(station_id,
Tmin,
Tmax,
Tmed,
RHmin,
RHmax,
RHmed,
rain,
Wmax,
slpres,
insertion_date)
(
SELECT
stations.station_id AS stId,
min(stations_rt_data.T) AS tmax,
max(stations_rt_data.T) AS tmin,
avg(stations_rt_data.T) AS tmed,
min(stations_rt_data.RH) AS rhmin,
max(stations_rt_data.RH) AS thmax,
avg(stations_rt_data.RH) AS rhmed,
sum(stations_rt_data.rain) AS rain,
max(stations_rt_data.Wmax) AS wmax,
stations_rt_data.pres AS pres,
NOW() AS tempo
FROM (
stations INNER JOIN stations_rt_data ON stations.code =
stations_rt_data.station_id
)
WHERE
stations_rt_data.observation_datetime_gmt
BETWEEN DATE_FORMAT('2005/01/21 > 00:00:00', '%Y%m%d%H%i%s')
AND DATE_FORMAT('2005/01/21 > 23:59:59', '%Y%m%d%H%i%s')
GROUP BY
stations_rt_data.station_id
)
It works fine for every value bt *stations_rt_data.pres*:it looks for
all observations collected during the past 24 hours.
But I need to get the value of this field at a particular
*stations_rt_data.observation_datetime_gmt
*Can I modify this query in order to get *stations_rt_data.pres* select
for a particular *stations_rt_data.observation_datetime_gmt *leaving
other fields selected as shown in the query WHERE part?
Thanks!
*
*

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.