Re: update problem
От | Oliver Elphick |
---|---|
Тема | Re: update problem |
Дата | |
Msg-id | 1031581752.25060.221.camel@linda обсуждение исходный текст |
Ответ на | update problem (Sudharshan Reddy <Sudharshan.Gundlapalle@mcs.vuw.ac.nz>) |
Список | pgsql-novice |
On Mon, 2002-09-09 at 02:55, Sudharshan Reddy wrote: > How can I update several columns in one UPDATE query ? > The users's guide says: > UPDATE table SET col = expression [, ...] ^^^^^^^^^^^^^^^^^^^^^^^^ > [ FROM fromlist ] > [ WHERE condition ] ... > UPDATE timed SET month='january' where month='1' and set month='feb' where month = '2'; > ERROR: parser: parse error at or near "month" That isn't setting two different columns. You are trying to update the same column with 2 different WHERE clauses. These must be two separate queries. UPDATE timed SET month='january' where month='1'; UPDATE timed SET month='feb' where month = '2'; Updating multiple columns works like this: UPDATE timed SET month='january', year=2002 WHERE ... -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Submit yourselves therefore to God. Resist the devil, and he will flee from you." James 4:7
В списке pgsql-novice по дате отправления: