Re: DATE_SUB Issues

From: Date: Mon, 29 Mar 2004 16:56:21 +0000
Subject: Re: DATE_SUB Issues
References: 1 2 3 4 5 6  Groups: php.db 
Request: Send a blank email to php-db+get-33688@lists.php.net to get a copy of this message
What is should doing is grabbing all entries of this week and return a total. Its returning the wrong results. SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), WEEK(time_upload, 1) FROM TRAININGLOG WHERE DATE_SUB( NOW(),INTERVAL 7 DAY ) <= time_upload GROUP BY time_upload LIMIT 1 => Results: (This is wrong) => Weekly Miles: (Week starts on Monday) 5.34 Correct Results should be this: Weekly Miles: 30.5 __________________________________ Craig Hoffman - eClimb Media v: (847) 644 - 8914 f: (847) 866 - 1946 e: choffman@eclimb.net w: www.eclimb.net _________________________________ On Mar 29, 2004, at 10:29 AM, John W. Holmes wrote:
From: "Craig Hoffman" <choffman@katomic.com>
On Mar 29, 2004, at 10:06 AM, John W. Holmes wrote:
From: "Craig Hoffman" <choffman@katomic.com>
still no luck - any other suggestions?
Please define "no luck"
Yes of course. Here is my new query. SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), WEEK(time_upload, '7') FROM TRAININGLOG WHERE DATE_SUB( NOW(),INTERVAL 7 DAY ) <= time_upload GROUP BY time_upload LIMIT 1
So how does it not work? What are you expecting? What is returned? Is an error occuring or the wrong results or no results?? ---John Holmes...


« previous php.db (#33688) next »