Re: Best way to save reports, comments and suggestions welcome

From: Date: Mon, 29 May 2006 14:04:44 +0000
Subject: Re: Best way to save reports, comments and suggestions welcome
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237025@lists.php.net to get a copy of this message
On Mon, 2006-05-29 at 08:55, Ryan A wrote: > > Regardless of how you determine the end of the > > logged in time, you > > shouldn't track all the different sums in every > > entry since that's > > redundant. You don't even need the extra data since > > the database will > > happily allow you to perform the SUMs via queries. > > I have done very little SUM queries with time, can you > give me a quick example or any site where i can find a > few sample queries? This is basic MySQL so you should RTFM, and generally should be asking on a MySQL list :) SELECT SUM( UNIX_TIMESTAMP( logout_time ) - UNIX_TIMESTAMP( login_time ) ) AS seconds FROM some_table WHERE user_id = 1; If you have MySQL >= 4.1.1 then you should probably use the TIMEDIFF() function. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#237025) next »