USE khms SET startTime 2015-01-01 endTime 2015-01-02 minute_rnd SELECT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
USE khms
SET
@startTime='2015-01-01',
@endTime='2015-01-02',
@minute_rnd=1
SELECT * FROM
(SELECT
round_minutes(date_time,@minute_rnd) dt,
temp_out,out_hum, wind_dir
FROM davis
WHERE date_time BETWEEN @startTime and @endTime
) davis
LEFT JOIN
(SELECT
round_minutes(date_time,@minute_rnd) dt,
cons,sigma
FROM dasibi
WHERE date_time BETWEEN @startTime and @endTime
) dasibi
USING (dt)
LEFT JOIN
(SELECT
round_minutes(date_time,@minute_rnd) dt,
(n0*ifnull(flow,1)*ifnull(work_int,1)) sum_a
FROM las
WHERE date_time BETWEEN @startTime and @endTime
) las
USING (dt)
WHERE wind_dir IN('W','NW','SW','S','SSW','NNW')
LIMIT 0,30