Re: Get the last record alone from the select statement.

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Get the last record alone from the select statement.
Дата
Msg-id 1059136610.26034.48.camel@haggis
обсуждение исходный текст
Ответ на Re: Get the last record alone from the select statement.  ("A.Bhuvaneswaran" <bhuvan@symonds.net>)
Список pgsql-novice
On Fri, 2003-07-25 at 04:53, A.Bhuvaneswaran wrote:
> > Hi all,
> >   I have a doubt in limit clause. With limit and offset i can get the
> > first few records from the select statement. Suppose i want to get the
> > last record alone from the select, how can i achieve it.
>
> => select your_fields from your_table where your_condition order by
> oid desc limit 1;

Since oid is way non-standard, a better way may be:
=> select your_fields from your_table where your_condition order by
your_fields desc limit 1;

--
+-----------------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron.l.johnson@cox.net             |
| Jefferson, LA  USA                                              |
|                                                                 |
| "I'm not a vegetarian because I love animals, I'm a vegetarian  |
|  because I hate vegetables!"                                    |
|    unknown                                                      |
+-----------------------------------------------------------------+



В списке pgsql-novice по дате отправления:

Предыдущее
От: papapep
Дата:
Сообщение: Re: Questions about Exists-Not exists clause
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Questions about Exists-Not exists clause