Re: Getting 'n-1'th record.

Поиск
Список
Период
Сортировка
От omid omoomi
Тема Re: Getting 'n-1'th record.
Дата
Msg-id F151GQvnbEG10Gai4om0000bf5c@hotmail.com
обсуждение исходный текст
Ответ на Getting 'n-1'th record.  (Bhuvan A <bhuvansql@yahoo.com>)
Список pgsql-sql
Hi,
It is a not a clean job but how about having a view like this :

create view foo_view as select * from yourtable order by oid desc limit 2 ;

and then making your select like this:
select * from foo_view order by oid limit 1;

hope that helps
Omid

>From: Bhuvan A <bhuvansql@yahoo.com>
>To: pgsql-sql@postgresql.org
>Subject: [SQL] Getting 'n-1'th record.
>Date: Tue, 21 Aug 2001 13:11:33 +0530 (IST)
>
>
>hi all,
>
>consider below..
>
>An sql query results with 'n' records. OK.
>I need ONLY the 'n-1'th record.
>
>
>HOW CAN I GET THIS?
>
>Thankx in advance!
>
>      
>======================================================================
>      Q:    What's the difference between the 1950's and the 1980's?
>      A:    In the 80's, a man walks into a drugstore and states loudly, "I'd
>         like some condoms," and then, leaning over the counter, whispers,
>                   "and some cigarettes."
>
>      
>======================================================================
>
>Regards,
>Bhuvaneswar.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp



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

Предыдущее
От: Bhuvan A
Дата:
Сообщение: Getting 'n-1'th record.
Следующее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: Primary vs Unique Index