Re: immediate set values
| От | Gregory Seidman |
|---|---|
| Тема | Re: immediate set values |
| Дата | |
| Msg-id | 20020519173413.A29305@jamaica.cs.brown.edu обсуждение исходный текст |
| Ответ на | Re: immediate set values ("Joel Burton" <joel@joelburton.com>) |
| Список | pgsql-general |
Joel Burton sez: } Something like: } } INSERT INTO mytable SELECT 1, * FROM (select 1 } union all } select 2 } union all } select 3 } union all } select 4) } } will work, but will run slowly, assuming you'll be inserting more than 4 } rows at a time. } } You could make a helper table that just contains integers <= n, if n is the } max number of rows you want to insert. } } Then } } INSERT INTO mytable SELECT 1, i FROM ints WHERE i < 100; Okay, I'm an idiot. The table I'm inserting into has two columns, each of which references a key in another table. I already have the helper table I need. Thanks for your help. My query now looks like: INSERT INTO mytable SELECT 1, id FROM referencedtable WHERE id IN (1,2,3,4) } - J. --Greg
В списке pgsql-general по дате отправления: