Re: is this possible? it should be!

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: newsreader(at)mediaone(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: is this possible? it should be!
Date: 2001-08-20 12:44:56
Message-ID: 20010820074456.A28452@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Aug 19, 2001 at 01:49:00PM -0400,
newsreader(at)mediaone(dot)net wrote:
> Hello
>
> I have statements (highly simplified just to get
> the point across) like
>
> select a,b,c from a where d=2 order by e limit 10;
>
> Now I think that because of "order by" the above query
> already "knows" the result of the below query
>
> 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.

Shouldn't:

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

do what you want?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2001-08-20 12:49:54 Re: is this possible? it should be!
Previous Message Ivan Babikov 2001-08-20 11:05:46 Is it possible to work with big databases (up to 10Gb) under Postgres?