On 12/07/2010 08:04 AM, Kobi Biton wrote:
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> now() - interval '10 minutes') Thanks! Kobi
Not sure this is what you want but here, reminder count(*) can have performance issues for large values of count():
SELECT a.eventuei AS _eventuei, case count(*) when 0 then 1 else count(*) end AS _ct, 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> now() - interval '10 minutes') -- Adrian Klaver adrian.klaver@xxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general