pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedUPDATE Multiple Records At Once?
3+ messages / 3 participants
[nested] [flat]
* UPDATE Multiple Records At Once?
@ 2012-04-11 17:50 Carlos Mennens <carlos.mennens@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Carlos Mennens @ 2012-04-11 17:50 UTC (permalink / raw)
To: pgsql-sql
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?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: UPDATE Multiple Records At Once?
@ 2012-04-11 19:20 lewbloch@gmail.com
parent: Carlos Mennens <carlos.mennens@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: lewbloch@gmail.com @ 2012-04-11 19:20 UTC (permalink / raw)
To: pgsql-sql
Carlos Mennens wrote:
> 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@xx**xx.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?
<http://www.postgresql.org/docs/9.1/static/sql-update.html;
--
Lew
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: UPDATE Multiple Records At Once?
@ 2012-04-11 20:55 Thomas Kellerer <spam_eater@gmx.net>
parent: Carlos Mennens <carlos.mennens@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Kellerer @ 2012-04-11 20:55 UTC (permalink / raw)
To: pgsql-sql
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'
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2012-04-11 20:55 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 17:50 UPDATE Multiple Records At Once? Carlos Mennens <carlos.mennens@gmail.com>
2012-04-11 19:20 ` lewbloch@gmail.com
2012-04-11 20:55 ` Thomas Kellerer <spam_eater@gmx.net>
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