Re: psql with PHP question

Поиск
Список
Период
Сортировка
От Joel Burton
Тема Re: psql with PHP question
Дата
Msg-id Pine.LNX.4.21.0105041614260.1389-100000@olympus.scw.org
обсуждение исходный текст
Ответ на Re: psql with PHP question  ("Gyozo Papp" <pgerzson@freestart.hu>)
Список 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 по дате отправления:

Предыдущее
От: "Christian Marschalek"
Дата:
Сообщение: Re: Removing my email!
Следующее
От: David Olbersen
Дата:
Сообщение: Re: Using system call + wrapper?