Re: limit based on count(*)

From: Steve Clark <sclark(at)netwolves(dot)com>
To: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>
Cc: Alban Hertroys <haramrae(at)gmail(dot)com>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: limit based on count(*)
Date: 2013-02-22 16:19:02
Message-ID: 51279A76.3050800@netwolves.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/22/2013 11:14 AM, Russell Keane wrote:
>
>
> > select serial_no, count(*) as "restarts" from event_log where event_mesg ilike 'system sta%' and event_date > current_date - 7
> > group by serial_no
>
> > having count(*) > X
>
> > order by restarts
>
> I think having is the better option.
>
Thanks all, didn't know about having - I am noobie with SQL.

--
Stephen Clark

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-02-22 17:23:34 Re: Access a window's frame_end row from a window function
Previous Message Russell Keane 2013-02-22 16:14:34 Re: limit based on count(*)