I have a table with 5,000 rows in it. I also have a query that returns
about 950 rows, but I only want items 50-60 from that match.
        What I want to show the user is
          - the total # of matches (950)
          - the 10 rows that I want

The following works, but can it be reduced to a single query?

        SELECT COUNT(*) FROM ... WHERE ...
        (print out the total number of matches)

        SELECT * FROM ... WHERE ... OFFSET 50 LIMIT 10
        (print out the 10 rows)

pg_cmdtuples($result) shows the number of *affected* tuples.

Thanks, Jeff 

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

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

Reply via email to