Using the IN predicate in an UPDATE...

Поиск
Список
Период
Сортировка
От Thomas Good
Тема Using the IN predicate in an UPDATE...
Дата
Msg-id Pine.LNX.3.96.981014085503.5064A-100000@admin.nrnet.org
обсуждение исходный текст
Ответ на Re: [SQL] dilemma  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Ответы Re: Using the IN predicate in an UPDATE...  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Re: [SQL] Using the IN predicate in an UPDATE...  (Leslie Mikesell <les@Mcs.Net>)
Список pgsql-sql
Herouth,

This query takes 20 years (poetic licence invoked ;-).
Do you have a smarter way to accomplish this end:

UPDATE table1 SET id = 2
WHERE rec_num IN
 ( SELECT rec_num
   FROM table1
   WHERE id = 1
  );

This is an attempt to cleanup some user error...I have an old
foxpro db that uses a char str as an index and this index has no
check constraints (like, making the index unique...ouch.)
The new pg db is performing nicely, now that it's live...and
housing 12 years worth of data.  But I am saddled with quite a bit
of housekeeping - correcting anomalies that were part and parcel
of the original (foxpro) design.  Or absence thereof.

Thanks much!
Tom

    ---------- Sisters of Charity Medical Center ----------
                   Department of Psychiatry
                            ----
    Thomas Good                          <tomg@q8.nrnet.org>
    Coordinator, North Richmond C.M.H.C. Information Systems
    75 Vanderbilt Ave, Quarters 8        Phone: 718-354-5528
    Staten Island, NY   10304            Fax:   718-354-5056



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

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] correlative insertion
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: Using the IN predicate in an UPDATE...