pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedGetting the number or row returned by a select. Alway tought it was not possible until I say pgAdmin who gives it
2+ messages / 2 participants
[nested] [flat]
* Getting the number or row returned by a select. Alway tought it was not possible until I say pgAdmin who gives it
@ 2005-04-15 19:53 David Gagnon <dgagnon@siunik.com>
0 siblings, 1 reply; 2+ messages in thread
From: David Gagnon @ 2005-04-15 19:53 UTC (permalink / raw)
To: pgsql-jdbc
Hi all,
In my system I alway do a select X from Y. followed by a select
count() from Y to get the number of row in my first request. I heard it
was possible to get the total number of rows from a select in a
VB6/MSSQL env.
Today I saw in PGAdminIII that it gives the count(*) from any query that
return more that 100 lines: This query return more than 100 rows (12234
rows) do you want to display them.
So did I miss something obvious. Is it possible to get the total number
of row returned from a query without doing another select.
Thanks to confirm that :-)
Have a goog week-end
/David
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Getting the number or row returned by a select. Alway
@ 2005-04-15 20:04 Kris Jurka <books@ejurka.com>
parent: David Gagnon <dgagnon@siunik.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2005-04-15 20:04 UTC (permalink / raw)
To: David Gagnon <dgagnon@siunik.com>; +Cc: pgsql-jdbc
On Fri, 15 Apr 2005, David Gagnon wrote:
> So did I miss something obvious. Is it possible to get the total number
> of row returned from a query without doing another select.
>
Anytime you've got the results of a query you can loop over it to count
the number of elements. In JDBC with a scrollable ResultSet you may issue
rs.last() and rs.getRow() to get the number of rows. rs.beforeFirst()
will then reset the ResultSet back to its original state.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-04-15 20:04 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 19:53 Getting the number or row returned by a select. Alway tought it was not possible until I say pgAdmin who gives it David Gagnon <dgagnon@siunik.com>
2005-04-15 20:04 ` Re: Getting the number or row returned by a select. Alway Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox