Re: simple? query - Mailing list pgsql-sql

From Relyea, Mike
Subject Re: simple? query
Date
Msg-id AF7D9319B29A0242A33C3BF843BD313308A204EB@USA7061MS03.na.xerox.net
Whole thread Raw
In response to simple? query  (Jan Verheyden <jan.verheyden@uz.kuleuven.ac.be>)
List pgsql-sql
> From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Jan Verheyden
> Subject: [SQL] simple? query
>
> Hi,
> I was trying to run following query but doesn't work:
> if (uid='janvleuven10') then
>   insert into test (registered) values ('1');
> else
>   insert into test (registered) values ('0');
> end if;



Perhaps UPDATE is what you're looking for?
http://www.postgresql.org/docs/8.4/static/sql-update.html

UPDATE test SET registered = '1' WHERE uid = 'janvleuven10';
UPDATE test set registered = '0' WHERE uid <> 'janvleuven10';

Mike


pgsql-sql by date:

Previous
From: Jan Verheyden
Date:
Subject: simple? query
Next
From: Jasen Betts
Date:
Subject: Re: mail alert