Re: selecting the last record from a table

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: selecting the last record from a table
Дата
Msg-id m38yzpl6nr.fsf@varsoon.wireboard.com
обсуждение исходный текст
Ответ на selecting the last record from a table  (MT <mt@open2web.com>)
Ответы Re: selecting the last record from a table  (Ericson Smith <eric@did-it.com>)
Список pgsql-general
MT <mt@open2web.com> writes:

> I have a script that inserts a record into a table and increments the
> unique field using nextval('my_sequence'). My problem is once I have
> inserted the record, I'd like to select this same record and display
> it so that the user knows he has actually inserted the record. I'm
> wondering if there's a bit of sql to select the last record.

SELECT * FROM mytable WHERE my_unique_field = currval('my_sequence');

-Doug

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

Предыдущее
От: MT
Дата:
Сообщение: selecting the last record from a table
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Update table with max occurance from another table