Select max row

From: Date: Mon, 05 Aug 2002 10:12:44 +0000
Subject: Select max row
Groups: php.db 
Request: Send a blank email to php-db+get-21000@lists.php.net to get a copy of this message
I have a timesheet table with the following columns: project month date start stop company_ID There can be more than one start/stop entry for each date. I want to select the most recent date, as well as the latest stop time for that date. I tried the following query: SELECT date, stop FROM timesheet WHERE date = max(date) Which did not work. The error was Invalid use of group function. I think I need to do a join of the table to itself, but I'm not sure exactly how to formulate the query. Any suggestions are much appreciated. If the problem is not clear, please let me know what to clarify. Thanks, -Lisi

« previous php.db (#21000) next »