Re: Select max row
| From: | Pierre-Alain Joye | Date: | Mon, 05 Aug 2002 18:46:19 +0000 |
| Subject: | Re: Select max row | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21001@lists.php.net to get a copy of this message | ||
On Mon, 05 Aug 2002 12:12:44 +0200
Lisi <lists@shemeshdirectory.co.il> wrote:
> 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)
SELECT date, stop FROM timesheet ORDER BY date DESC LIMIT 1
hth
pa