Salut,
> J'ai un grand nombre d'entrées dans une table de la forme :
>
> champ_1 | champ_2 |
> --------+---------+
> 1 | 1 |
> 2 | 1 |
> 3 | 1 |
> ...
> n | 1 |
>
> et je voudrais insérer les entrées (et non pas remplacer au moyen d'un
> update) :
>
> champ_1 | champ_2 |
> --------+---------+
> 1 | 2 |
> 2 | 2 |
> 3 | 2 |
> ...
> n | 2 |
>
> Y a-t-il une façon efficace de faire ceci (sans passer par un COPY
> depuis un fichier texte) ?
Quelque chose comme :
INSERT INTO matable SELECT champ_1, 2 FROM matable;
ou
INSERT INTO matable SELECT champ_1, champ_2 + 1 FROM matable;
ou
INSERT INTO matable SELECT champ_1, champ_2 + 1 FROM matable WHERE champ_1 < n;
Ou je n'ai pas compris la question ?
A+
Vincent