> 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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to