Hi All.
I have a mysql statement that I would really really like to call from my
Ruby program which goes like this:
SELECT a, b, DAYOFWEEK(date_time) as DOW,
HOUR(date_time) at hr,
AVG(x/y)
FROM records;
This is possible by creating a 3-dimentional array of a, b, date_time
containing x/y, and then finding averages and putting it into a
4-dimensional array of a, b, dow, and hr.
3-dim_array
a
b
date_time
4-dim_array
a
b
dow
hr
My reasons for not wanting to do it this way is that there could be
100,000+ records. Also, look at how pretty and compact that the MySql
statement is! I would much rather let MySql handle all that because
arrays will get very big, and I’m not sure if or how Ruby can handle
that.
Can someone tell me if I can use the above MySql statement to generate
the 4-dimentional array? If not, can someone please help me find a
possible solution?
Danke in advance!