Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3B093633C8F for ; Fri, 14 Aug 2009 05:59:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 61192-03 for ; Fri, 14 Aug 2009 08:59:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from titania.wxnz.net (titania.wxnz.net [58.28.4.13]) by mail.postgresql.org (Postfix) with ESMTP id A4A8F633AC1 for ; Fri, 14 Aug 2009 05:59:05 -0300 (ADT) Received: from gonzo (ip-118-90-142-121.xdsl.xnet.co.nz [118.90.142.121]) by titania.wxnz.net (Postfix) with ESMTP id 7857E1098140 for ; Fri, 14 Aug 2009 20:59:01 +1200 (NZST) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1Mbsck-000081-QT for pgsql-sql@postgresql.org; Fri, 14 Aug 2009 20:58:58 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: simple? query Date: 14 Aug 2009 08:58:58 GMT Organization: Dis (not Dat) Organisation Lines: 26 Message-ID: References: NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1250240338 31529 127.0.0.1 (14 Aug 2009 08:58:58 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.627 tagged_above=-10 required=5 tests=AWL=0.972, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/74 X-Sequence-Number: 32983 On 2009-08-13, Jan Verheyden 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 );