Re: select first occurrence of a table

Поиск
Список
Период
Сортировка
От nolan@celery.tssi.com
Тема Re: select first occurrence of a table
Дата
Msg-id 20030502175318.6914.qmail@celery.tssi.com
обсуждение исходный текст
Ответ на select first occurrence of a table  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Список pgsql-general
> > I have a table that happens to have a some
> > duplicate entries in it (entire rows).  I would like
> > to update one row and change one thing
> > about it, but it seems that I need a unique value
> > to do it; otherwise, I wind up changing multiple
> > rows.

If you don't care which of the two rows you change (and if they're
identical why would you?), you could do it with the following:

   update foo set field1 = 'ZZZ' where oid =
      (select min(oid) from foo where field2 = 'XXX');

max(oid) would work too.
--
Mike Nolan


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

Предыдущее
От: Erik Ronström
Дата:
Сообщение: Re: select first occurrence of a table
Следующее
От: Dennis Gearon
Дата:
Сообщение: Re: select first occurrence of a table