Re: limit based on count(*)

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Steve Clark <sclark(at)netwolves(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: limit based on count(*)
Date: 2013-02-22 16:05:44
Message-ID: CAF-3MvOmSQwZgE2J+_x8n10ys7sXzy26DZ1w69CTCejzcN7QCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 22 February 2013 17:01, Steve Clark <sclark(at)netwolves(dot)com> 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 order by restarts
>

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

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Russell Keane 2013-02-22 16:08:52 Re: limit based on count(*)
Previous Message Merlin Moncure 2013-02-22 16:01:19 Re: Access a window's frame_end row from a window function