From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: simple? query |
Date: | 2009-08-14 08:58:58 |
Message-ID: | h6390i$up9$3@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 2009-08-13, Jan Verheyden <jan(dot)verheyden(at)uz(dot)kuleuven(dot)ac(dot)be> wrote:
> --_004_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_
> Content-Type: multipart/alternative;
> boundary="_000_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_"
>
> --_000_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> 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;
that's not SQL. (it could be plpgsql)
if you need to do it in SQL do this.
insert into test (registered)
values ( case when uid='janvleuven10' then '1' else '0' end );
From | Date | Subject | |
---|---|---|---|
Next Message | Hengky Lie | 2009-08-14 09:20:58 | Field or record level encryption / decryption |
Previous Message | Adrian Klaver | 2009-08-13 23:30:41 | Re: mail alert |