Skip site navigation (1) Skip section navigation (2)

Problem with UPDATE query

From: Johan Daine <johan(dot)daine(at)chello(dot)be>
To: pgsql-novice(at)postgresql(dot)org
Subject: Problem with UPDATE query
Date: 2001-02-09 00:05:24
Message-ID: 3A833444.1DD45DB5@chello.be (view raw or flat)
Thread:
Lists: pgsql-novice
How can I update several columns in one UPDATE query ?
The users's guide says:

UPDATE table SET col = expression [, ...]
    [ FROM fromlist ]
    [ WHERE condition ]

But this is what I get:

jd=> CREATE TABLE foo (v1 INT2, v2 INT2, v3 INT2 );
CREATE
jd=> insert into foo values(1,2,3);
INSERT 22187 1
jd=> UPDATE foo SET v2=3 , SET v3=4 WHERE v1=1 ;
ERROR:  parser: parse error at or near "v3"
jd=>

Thanks

--
           _/    /_/_/_/            Johan Daine
          _/    /_/    _/           mailto:isis(at)wanadoo(dot)be
         _/    /_/    _/            http://web.wanadoo.be/isis.w
        _/    /_/    _/
       _/    /_/    _/
 /_/_/_/    /_/_/_/



Responses

pgsql-novice by date

Next:From: Raymond GolishDate: 2001-02-09 01:56:00
Subject: arrays of compound types
Previous:From: Fred SchroederDate: 2001-02-08 20:19:16
Subject: Getting Started

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group