Hi There, Well the first and last record of the results. So if 1000 records were found... then record #1 and then record #1000 - perform data calculation between those 2 records (how many days does this query span). Know what I am trying to say? Sorry if its not clear. Aaron -----Original Message----- From: Jason Vincent [mailto:jayv@nortelnetworks.com] Sent: November 13, 2002 12:24 PM To: Aaron Wolski; php-db@lists.php.net Subject: RE: Difference between 2 dates.. thoughts? You should be able to do this at the database level - of course you never said what database that is. Regardless, check your database documentation for the max() and min() functions - never used these on date but they might work - do you always want the first record and the last record in the database? Or do you mean the first and last record of the record set? If you always want the first record inserted and the last record inserted, than use max() and min() in the unique database key (the unique record number) assuming you have one and that they are sequential. Then check for any date functions that might be able to tell the days elapsed between to dates (in mySQL you might look at the interval function). Regards, J -----Original Message----- From: Aaron Wolski [mailto:aaronjw@martekbiz.com] Sent: Wednesday, November 13, 2002 11:33 AM To: php-db@lists.php.net Subject: Difference between 2 dates.. thoughts? Hi All, First off I have a query like this: SELECT dateinserted FROM SiteTrackingTable; Now. in this query any number of results could be returned 10 or 1000, etc. Is it possible to take the dateinserted value from the first record and then from the last record and perform some calculation to get the number of days the record spans? Haven't done something like this before and don't have a clue where to start. Date sorting,etc I can do just don't know about this one. Thanks for your help! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php