Ok, well, I thought this was going to help me with my problem, but
unfortunately, it didn't.  That's not to say that the answer was
incorrect.  Here's what I'm trying to do (with a little background).

I run a stats page for SETI@Home.  It's mySQL driven, with perl
generating static html pages.  I store UserId, TotalWu, Last24Wu,
Avg7Day, and DateStamp.  Sometimes, however, the SETI servers are
unreachable, and I have my stats pages insert default values if they
can't be contacted.  If this happens, then the Avg7Day field somehow
gets corrupted (for a short time), and so the wrong information is
displayed.  I want to write a script that will update all the records
Avg7Day field.  Basically, the Avg7Day field should equal this formula:

(TotalWu (from current DateStamp) - TotalWu (from DateStamp - 7 Days)) /
7

Which is simple enough.  However, if there are less than 7 days of data
(or we just haven't gotten to the 7th day yet, it should then be:

(TotalWu (from current DateStamp) - TotalWu (from MIN DateStamp)) /
TO_DAYS(currentDateStamp - MIN DateStamp)



Can anyone shed some light on my situation?

Thanks in advance!

-----Original Message-----
From: Alain Fontaine [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 05, 2002 11:01 AM
To: Solsberry, Glendon; [EMAIL PROTECTED]
Subject: RE: MIN/MAX Date Field


How about:

select some_data from the_table order by the_date ASC limit 1

?

-----Message d'origine-----
De : Solsberry, Glendon [mailto:[EMAIL PROTECTED]]
Envoye : vendredi 5 juillet 2002 16:52
A : [EMAIL PROTECTED]
Objet : MIN/MAX Date Field


Is there a way to select some data from a table where the date field is
the MIN() of that date column?  Aka, if I have 100 rows of data, and the
MIN() date is 1/1/2000, then I want to select the data that is from
1/1/2000.  Can this be done without doing a multi-table join, or is that
the only way to handle this???

Mysql, table

-------------------------

Glendon Solsberry
Internet Programmer
Tricon Global Restaurants
tel. (502) 874-6736
fax (502) 874-8818


This communication is confidential and may be legally privileged.  If
you are not the intended recipient, (i) please do not read or disclose
to others, (ii) please notify the sender by reply mail, and (iii) please
delete this communication from your system.  Failure to follow this
process may be unlawful.  Thank you for your cooperation.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This communication is confidential and may be legally privileged.  If you are not the 
intended recipient, (i) please do not read or disclose to others, (ii) please notify 
the sender by reply mail, and (iii) please delete this communication from your system. 
 Failure to follow this process may be unlawful.  Thank you for your cooperation.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to