Re: if-clause to an exiting statement

From: Kobi Biton <kobi(at)comns(dot)co(dot)il>
To: adrian(dot)klaver(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: if-clause to an exiting statement
Date: 2010-12-07 16:04:39
Message-ID: 1291737879.17275.6.camel@kbiton-lap-ub
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian hi,

Thanks for the reply can you please show me how to incorporate the below
into my below statement ?

SELECT a.eventuei AS _eventuei,
a.nodeid AS _nodeid,
a.ipaddr AS _ipaddr,
now() AS _ts
FROM events a
WHERE
eventuei='uei.opennms.org/comns/backup-success-trap' AND
(eventcreatetime &gt; now() - interval '10 minutes')

Thanks!
Kobi

On Tue, 2010-12-07 at 07:36 -0800, Adrian Klaver wrote:
> On Tuesday 07 December 2010 3:58:46 am kobi.biton wrote:
> > hi thanks for the reply I did look at the CASE statement however cannot
> > seem to alter the returned row-count ...
> >
> > CASE WHEN (@@ROW-COUNT = 0) THEN
> >
> > [what do I write here?] @@ROW-COUNT = 1?
> >

> > END
> > --
> > View this message in context:
> > http://postgresql.1045698.n5.nabble.com/if-clause-to-an-exiting-statement-t
> >p3295519p3295641.html Sent from the PostgreSQL - general mailing list
> > archive at Nabble.com.
>
> See below:
>
> test=> SELECT count(*) from bool_test ;
> count
> -------
> 33
> (1 row)
>
> test=> SELECT count(*) ,
> case count(*) when 0
> then 1
> else
> count(*)
> end
> from
> bool_test ;
>
> count | count
> -------+-------
> 33 | 33
> (1 row)
>
> test=> SELECT count(*) ,
> case count(*) when 0
> then 1
> else
> count(*)
> end
> from
> bool_test
> where
> ifd=0;
>
> count | count
> -------+-------
> 0 | 1
> (1 row)
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>

--
Kobi Biton
Com N S Ltd.

Mobile: +972 (54) 8017668

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2010-12-07 16:08:49 Re: regexp err msg question
Previous Message Tom Lane 2010-12-07 15:45:21 Re: regexp err msg question