Re: UPDATE & LIMIT together?
От | Bruce Momjian |
---|---|
Тема | Re: UPDATE & LIMIT together? |
Дата | |
Msg-id | 200208281701.g7SH1aI20777@candle.pha.pa.us обсуждение исходный текст |
Ответ на | UPDATE & LIMIT together? (tp <tp@emaze.net>) |
Ответы |
Case Statement
Re: UPDATE & LIMIT together? |
Список | pgsql-sql |
You have to use a subquery returning the tables primary key to the UPDATE: UPDATE tab SET x=1WHERE (primkey, col) IN ( SELECT primkey,col FROM tab ORDER BY col LIMIT 10) --------------------------------------------------------------------------- tp wrote: -- Start of PGP signed section. > Hi > > I want to SELECT at max. 10 rows and SET a variable for the > select 10 rows with the same query. > > Under mysql i can use: > UPDATE table SET uniq_iq=12345 LIMIT 10 > SELECT * FROM table WHERE uniq_id=1234; > > This is not supported by postgres. > > Is there some easy solution that does not require locking? > > > -tp -- End of PGP section, PGP failed! -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-sql по дате отправления: