Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Dell PowerEdge Servers
  #1  
Old May 23rd, 2002, 08:37 PM
rwar rwar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 rwar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old May 23rd, 2002, 08:50 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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....

Reply With Quote
  #3  
Old May 23rd, 2002, 09:10 PM
rwar rwar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 rwar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > get data 10 by 10 days


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway