List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:July 2 1999 5:04pm
Subject:Re: SELECT WHERE id = MAX(id)
View as plain text  
On Fr, 1999-07-02 18:14:10 +0200, Tony Bowden <tony@stripped> wrote:
> How can get the amount for the maximum id in one query?

The MySQL specific "LIMIT" does help here:

  SELECT id, amount FROM foo ORDER BY id DESC LIMIT 1;

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
SELECT WHERE id = MAX(id)tony2 Jul
  • Re: SELECT WHERE id = MAX(id)Paul Wolstenholme2 Jul
    • Re: SELECT WHERE id = MAX(id)tony2 Jul
  • Re: SELECT WHERE id = MAX(id)Martin Ramsch2 Jul
    • Re: SELECT WHERE id = MAX(id)Steve Ruby2 Jul
Re: SELECT WHERE id = MAX(id)tony3 Jul
  • Re: SELECT WHERE id = MAX(id)Steve Ruby3 Jul