Re: SQL syntax rowcount value as an extra column in the result set

From: "Jayadevan M" <Jayadevan(dot)Maymala(at)ibsplc(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org,pgsql-sql-owner(at)postgresql(dot)org
Subject: Re: SQL syntax rowcount value as an extra column in the result set
Date: 2010-03-26 03:42:01
Message-ID: OFA0B1E010.BE09B175-ON652576F2.00143421-652576F2.0014316E@LocalDomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
I don't think so.
Oracle -
SQL> select count(*) over () as ROWCOUNT , first_name from people;

ROWCOUNT FIRST_NAME
----------
---------------------------------------------------------------------
-------------------------------
6 Mary
6 Mary
6 John
6 John
6 John
6 Jacob

6 rows selected.

PostgreSQL
postgres=# select count(*) over () as ROWCOUNT , first_name from people;
ERROR: syntax error at or near "over"
LINE 1: select count(*) over () as ROWCOUNT , first_name from people...
^
Regards,
Jayadevan

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Date: 26/03/2010 03:26
Subject: Re: [SQL] SQL syntax rowcount value as an extra column in
the result set
Sent by: pgsql-sql-owner(at)postgresql(dot)org

Snyder, James wrote on 25.03.2010 22:33:

> I’m using PostgreSQL (8.4.701)
There is no such version.
The current version is 8.4.3

> On a side note, Oracle allows the following syntax to achieve the above:
>
> select count(*) over () as ROWCOUNT , first_name from people
>
The same syntax will work on Postgres

Thomas

--
Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2010-03-26 06:23:50 Re: SQL syntax rowcount value as an extra column in the result set
Previous Message Jayadevan M 2010-03-26 03:35:00 Re: SQL syntax rowcount value as an extra column in the result set