|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
get data 10 by 10 days
The structure of the table is like this:
date tmax tmin 1961-01-01 28.5 20.1 1961-01-02 27.4 20.3 ... 1961-12-31 25.4 22.3 1962-01-01 26.7 21.2 ... As you can see, the data are in a day by day order. How do I do to get values in 10 by 10 days. For example, get values from 1961-01-01 to 1961-01-10, then 1961-01-11 to 1961-01-20, then 1961-01-21 to 1961-01-31, and so on. I can get them month by month: $result_temp_year = mysql_query( "SELECT AVG(( tmax + tmin ) / 2 ) AS temp_avg_year FROM dados GROUP BY YEAR( data )" ); data is my date field, ok? Any help or suggestion would be very appreciated. Thanks in advance. |
|
#2
|
|||
|
|||
|
RE: get data 10 by 10 days
Not sure exactly what you are looking for, but try these:
SELECT data,( tmax + tmin ) / 2 AS temp_avg_year FROM dados ORDER BY data LIMIT 0,10 or SELECT AVG(( tmax + tmin ) / 2) AS temp_avg_year FROM dados ORDER BY data LIMIT 0,10 if those don't produce what you want..show the results here that you want.... |
|
#3
|
|||
|
|||
|
RE: get data 10 by 10 days
Thanks for your reply.
I've tried your code, but it returns me only the first 10 days of the table. What I really want is to put together the first 10 elements of the table, e.g. the data from 1961/01/01 until 1961/01/10, then the next 10 elements (1961/01/11 until 1961/01/20), and then the next 11 until elements ('cause it's january, right?). The next month is february, so I have to get the data from 1961-02-01 (note the second number = 02 = february) until 1961-02-10, then the next 10 (1961-02-11 until 1961-02-20) and so on. In summary, I have to each 10 or 11 lines ('cause of number of days of each month). I have 40 (FORTY!!!) years of data inside the table, (14610 recors, to be more precise). I just cannot get the values line by line. Imagine how much lines I'd write just to get the values ... I'm getting crazy to do that. Did you get the idea? If I was not clear enough again :-( please tell me. Thanks. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > get data 10 by 10 days |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|