Re: psql with PHP question - Mailing list pgsql-php

From Joel Burton
Subject Re: psql with PHP question
Date
Msg-id Pine.LNX.4.21.0105041614260.1389-100000@olympus.scw.org
Whole thread Raw
In response to Re: psql with PHP question  ("Gyozo Papp" <pgerzson@freestart.hu>)
List pgsql-php
On Thu, 3 May 2001, Gyozo Papp wrote:

> In my opinion, these queries make the same :
> SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
> SELECT MAX(id) FROM article;
>
> but the latter one is much more simple and you do not overload your pg.
> (by the way, I think id = (SELECT ...) isn't handled gracefully.)

Yep, it's much better.

If you want to get more than just the ID, try:

   select * from article order by id desc limit 1;

HTH,
--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




pgsql-php by date:

Previous
From: "Christian Marschalek"
Date:
Subject: Re: Removing my email!
Next
From: David Olbersen
Date:
Subject: Re: Using system call + wrapper?