Re: [SQL] UPDATE Multiple Records At Once?

2012-04-16 Thread lewbloch
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
> +---+---++
>  16 | 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?



-- 
Lew

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] ERROR: operator does not exist: integer = integer[]

2012-04-16 Thread cesar_cast
I have the following 

select *
from   employee AS e
where  (e.id) IN  (ARRAY[3,1]);

I have the following mistake
ERROR:  operator does not exist: integer = integer[]
LINE 3: where  (e.id) IN  (ARRAY[3,1]);
  ^
HINT:  No operator matches the given name and argument type(s). You might
need to add explicit type casts.

** Error **

ERROR: operator does not exist: integer = integer[]
SQL state: 42883
Hint: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
Character: 45


Can anybody explain me?


--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/ERROR-operator-does-not-exist-integer-integer-tp5634039p5634039.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] ERROR: operator does not exist: integer = integer[]

2012-04-16 Thread Pavel Stehule
Hello

this is not error, you cannot use predicate IN in this context

use =ANY instead

postgres=> select 10 = ANY(ARRAY[1,2,3]);
 ?column?
--
 f
(1 row)

postgres=> select 10 = ANY(ARRAY[1,2,3,10]);
 ?column?
--
 t
(1 row)

Regards

Pavel Stehule


2012/4/11 cesar_cast :
> I have the following
>
> select *
> from   employee AS e
> where  (e.id) IN  (ARRAY[3,1]);
>
> I have the following mistake
> ERROR:  operator does not exist: integer = integer[]
> LINE 3: where  (e.id) IN  (ARRAY[3,1]);
>                      ^
> HINT:  No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>
> ** Error **
>
> ERROR: operator does not exist: integer = integer[]
> SQL state: 42883
> Hint: No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
> Character: 45
>
>
> Can anybody explain me?
>
>
> --
> View this message in context: 
> http://postgresql.1045698.n5.nabble.com/ERROR-operator-does-not-exist-integer-integer-tp5634039p5634039.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql