Re: simple? query

From: "Relyea, Mike" <Mike(dot)Relyea(at)xerox(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Cc: "Jan Verheyden" <jan(dot)verheyden(at)uz(dot)kuleuven(dot)ac(dot)be>
Subject: Re: simple? query
Date: 2009-08-13 20:46:31
Message-ID: AF7D9319B29A0242A33C3BF843BD313308A204EB@USA7061MS03.na.xerox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-13 21:54:20 Re: mail alert
Previous Message Jasen Betts 2009-08-13 12:16:21 Re: mail alert