pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: UPDATE Multiple Records At Once?
Date: Wed, 11 Apr 2012 22:55:08 +0200
Message-ID: <jm4r3a$ij7$1@dough.gmane.org> (raw)
In-Reply-To: <CAAQLLO5HwMETX31_jpT2U=HtoqW1gGkc8+qAE5xUMOmGAQTT4g@mail.gmail.com>
References: <CAAQLLO5HwMETX31_jpT2U=HtoqW1gGkc8+qAE5xUMOmGAQTT4g@mail.gmail.com>

Carlos Mennens wrote on 11.04.2012 19:50:
> I'm trying to update a customer record in a table however I need to
> change several values (cust_address, cust_contact, cust_email). My
> question is how do I properly format this into one single command?
>
>
> forza=# SELECT cust_id, cust_name, cust_address, cust_contact, cust_email
> forza-# FROM customers
> forza-# WHERE cust_name = 'iamUNIX'
> forza-# ;
>    cust_id   | cust_name |     cust_address      |  cust_contact  |
> cust_email
> ------------+-----------+-----------------------+----------------+--------------------
>   1000000006 | MobileNX   | 200 South Shore Drive | Carlos Mennens |
> carlos@mobilenx.com
> (1 row)
>
> I did a quick Google search and I can see there is a method or
> procedure which involves parenthesis () however I'm not sure how I
> would change all the values listed above under one command. Can anyone
> please give me a quick example so I can see how this is drawn out via
> ANSI SQL?
>

UPDATE customers
    SET cust_address = 'foo',
        cust_contact = 'Arthur',
        cust_email = 'arthur@foo.bar'
WHERE cust_name = 'iamUNIX'




view thread (3+ messages)

Message-ID: <jm4r3a$ij7$1@dough.gmane.org>
Permalink:  ../jm4r3a$ij7$1@dough.gmane.org/
Also on:    postgresql.org/message-id/jm4r3a$ij7$1@dough.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: UPDATE Multiple Records At Once?
  In-Reply-To: <jm4r3a$ij7$1@dough.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox