Dear readers
Assume two tables.
Table 1: 5 columns
date from; time from; date to; time to; measurement1 for this period
1-12-15 ; 08:00 ;1-12-15 ; 19:59 ; 0,89
1-12-15 ; 20:00 ;2-12-15 ; 07:59 ; 0,71
2-12-15 ; 08:00 ;2-12-15 ; 19:59 ; 0,91
2-12-15 ; 20:00 ;3-12-15 ; 07:59 ; 0,33
3-12-15 ; 08:00 ;3-12-15 ; 19:59 ; 0,56
…
And
Table 2: 3 columns
date ; time ; measurement2
1-12-15 09:00 0,52
1-12-15 10:00 0,48
1-12-15 15:15 0,52
1-12-15 20:10 0,51
2-12-15 09:00 0,91
2-12-15 11:00 0,95
2-12-15 22:00 0,33
3-12-15 09:00 0,56
…
I would like to combine those two with a query, but how?
Result I would like to achieve is
All records + columns from Table 1 + columns Min, AVG, Max from table 2 in this period
date from ; time from ; date to ; time to; measurement1, min(measurement2), avg(measurement2), max(measurement2) in the same period
1-12-15 ; 08:00 ;1-12-15 ; 19:59 ; 0,89 ; 0,48 ; 0,50 ; 0,52 (min, max, avg between 08:00-20:00)
1-12-15 ; 20:00 ;2-12-15 ; 07:59 ; 0,71 ; 0,51 ; 0,51 ; 0,51 (min, max, avg between 20:00-08:00)
2-12-15 ; 08:00 ;2-12-15 ; 19:59 ; 0,91 ; 0,91 ; 0,93 ; 0,95 (min, max, avg between 08:00-20:00)
Etc…
Many thanks
Ben
Assume two tables.
Table 1: 5 columns
date from; time from; date to; time to; measurement1 for this period
1-12-15 ; 08:00 ;1-12-15 ; 19:59 ; 0,89
1-12-15 ; 20:00 ;2-12-15 ; 07:59 ; 0,71
2-12-15 ; 08:00 ;2-12-15 ; 19:59 ; 0,91
2-12-15 ; 20:00 ;3-12-15 ; 07:59 ; 0,33
3-12-15 ; 08:00 ;3-12-15 ; 19:59 ; 0,56
…
And
Table 2: 3 columns
date ; time ; measurement2
1-12-15 09:00 0,52
1-12-15 10:00 0,48
1-12-15 15:15 0,52
1-12-15 20:10 0,51
2-12-15 09:00 0,91
2-12-15 11:00 0,95
2-12-15 22:00 0,33
3-12-15 09:00 0,56
…
I would like to combine those two with a query, but how?
Result I would like to achieve is
All records + columns from Table 1 + columns Min, AVG, Max from table 2 in this period
date from ; time from ; date to ; time to; measurement1, min(measurement2), avg(measurement2), max(measurement2) in the same period
1-12-15 ; 08:00 ;1-12-15 ; 19:59 ; 0,89 ; 0,48 ; 0,50 ; 0,52 (min, max, avg between 08:00-20:00)
1-12-15 ; 20:00 ;2-12-15 ; 07:59 ; 0,71 ; 0,51 ; 0,51 ; 0,51 (min, max, avg between 20:00-08:00)
2-12-15 ; 08:00 ;2-12-15 ; 19:59 ; 0,91 ; 0,91 ; 0,93 ; 0,95 (min, max, avg between 08:00-20:00)
Etc…
Many thanks
Ben
Last edited: