Getting a total hit number and a LIMIT number at the same time

Поиск
Список
Период
Сортировка
Искать
От
Тема
Getting a total hit number and a LIMIT number at the same time
Дата
в 13:14:34
Msg-id
371EAC487A83CD4296F6999FD088D8331B7084@atlas.managestar.com
Список
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 
В списке pgsql-general по дате отправления
От: Gilles DAROLD
Дата:
Сообщение: Oracle to Pg tool
От: Janning Vygen
Дата:
Сообщение: updating rows while selecting
FAQ