Hello
I'm using PostgreSQL (8.4.701) and Java (jdbc,
postgresql-8.4-701.jdbc4.jar) to connect to the database.
My question is: what is the SQL syntax for PostgreSQL to achieve the
following:
I want to receive the rowcount along with the rest of a result set. For
example, let's say the following query returns
select first_name from people;
first_name
=========
Mary
Sue
Joe
and the following query returns the value
select count(*)as ROWCOUNT from people;
ROWCOUNT
==========
3
3
What I'm looking for is the output as
ROWCOUNT , first_name
=====================
3 , Mary
3 , Sue
3 , Joe
so I can use JDBC (snip-it) as follows:
resultSet.getInt("ROWCOUNT")
resultSet.getString("first_name")
On a side note, Oracle allows the following syntax to achieve the above:
select count(*) over () as ROWCOUNT , first_name from people
Thanks,Jim