Re: is this possible? it should be!

From: reina(at)nsi(dot)edu (Tony Reina)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: is this possible? it should be!
Date: 2001-08-20 23:56:29
Message-ID: f40d3195.0108201556.60c4fe39@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> select a,b,c from a where d=2 order by e limit 10;
> select count(*) from a where d=2;
>
> The point is that I want to know the total number
> of matches and I also want to use "limit". And
> I don't want to do two queries.
>

Perhaps GROUP BY will get you where you want to go:

select count(*), a, b, c from a where d=2 group by a, b, c order by e limit 10;

-Tony

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lee Harr 2001-08-21 00:12:55 Re: Problems with UPDATE
Previous Message Lee Harr 2001-08-20 23:52:54 Re: Missing Sequence File