Re: Getting statistics from tables

From: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>
To: Paulo Jan <admin(at)mail(dot)ddnet(dot)es>, pgsql-general(at)postgresql(dot)org
Subject: Re: Getting statistics from tables
Date: 2002-04-09 17:34:41
Message-ID: 3CB32631.7010704@mmrd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Users | Pages
> -----------------------------
> pepe | index.html
> johnsen | about.html
> paco | about.html
> paco | index.html
> pepe | download.html
>
>
> It's easy to see the last 5, or 10, or 15 pages that an user has seen,
> or the last users that have viewed a page. But how can I find out the 5
> most seen pages

It's an easier problem than you think. =)

select pages, count(*) from table group by pages order by count(*) desc
limit 5;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Stanfield 2002-04-09 17:38:33 Re: PostgreSQL and C#
Previous Message Paulo Jan 2002-04-09 17:00:34 Getting statistics from tables