Re: SQL syntax rowcount value as an extra column in the result set - Mailing list pgsql-sql
From | Jayadevan M |
---|---|
Subject | Re: SQL syntax rowcount value as an extra column in the result set |
Date | |
Msg-id | OFA0B1E010.BE09B175-ON652576F2.00143421-652576F2.0014316E@LocalDomain Whole thread Raw |
In response to | Re: SQL syntax rowcount value as an extra column in the result set (Thomas Kellerer <spam_eater@gmx.net>) |
Responses |
Re: SQL syntax rowcount value as an extra column in the result set
|
List | pgsql-sql |
<font face="sans-serif" size="2">Hi,</font><br /><font face="sans-serif" size="2">I don't think so.</font><br /><font face="sans-serif"size="2">Oracle - </font><br /><font face="sans-serif" size="2">SQL> select count(*) over () as ROWCOUNT, first_name from people;</font><br /><br /><font face="sans-serif" size="2"> ROWCOUNT FIRST_NAME</font><br /><fontface="sans-serif" size="2">---------- ---------------------------------------------------------------------</font><br/><font face="sans-serif" size="2">-------------------------------</font><br/><font face="sans-serif" size="2"> 6 Mary</font><br /><font face="sans-serif"size="2"> 6 Mary</font><br /><font face="sans-serif" size="2"> 6 John</font><br /><fontface="sans-serif" size="2"> 6 John</font><br /><font face="sans-serif" size="2"> 6 John</font><br/><font face="sans-serif" size="2"> 6 Jacob</font><br /><br /><font face="sans-serif" size="2">6 rowsselected.</font><br /><br /><font face="sans-serif" size="2">PostgreSQL</font><br /><font face="sans-serif" size="2">postgres=#select count(*) over () as ROWCOUNT , first_name from people;</font><br /><font face="sans-serif" size="2">ERROR: syntax error at or near "over"</font><br /><font face="sans-serif" size="2">LINE 1: select count(*) over() as ROWCOUNT , first_name from people...</font><br /><font face="sans-serif" size="2"> ^</font><br/><font face="sans-serif" size="2">Regards,</font><br /><font face="Trebuchet MS" size="2">Jayadevan</font><br/><br /><br /><br /><font color="#5f5f5f" face="sans-serif" size="1">From: </font><fontface="sans-serif" size="1">Thomas Kellerer <spam_eater@gmx.net></font><br /><font color="#5f5f5f" face="sans-serif"size="1">To: </font><font face="sans-serif" size="1">pgsql-sql@postgresql.org</font><br /><font color="#5f5f5f"face="sans-serif" size="1">Date: </font><font face="sans-serif" size="1">26/03/2010 03:26</font><br/><font color="#5f5f5f" face="sans-serif" size="1">Subject: </font><font face="sans-serif" size="1">Re:[SQL] SQL syntax rowcount value as an extra column in the result set</font><br /><font color="#5f5f5f" face="sans-serif"size="1">Sent by: </font><font face="sans-serif" size="1">pgsql-sql-owner@postgresql.org</font><br/><hr noshade /><br /><br /><br /><tt><font size="2">Snyder, James wroteon 25.03.2010 22:33:<br /><br />> I’m using PostgreSQL (8.4.701)<br />There is no such version.<br />The currentversion is 8.4.3<br /><br /><br />> On a side note, Oracle allows the following syntax to achieve the above:<br/>><br />> select count(*) over () as ROWCOUNT , first_name from people<br />><br />The same syntax willwork on Postgres<br /><br />Thomas<br /><br /><br />-- <br />Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)<br/>To make changes to your subscription:<br /></font></tt><a href="http://www.postgresql.org/mailpref/pgsql-sql"><tt><font size="2">http://www.postgresql.org/mailpref/pgsql-sql</font></tt></a><tt><fontsize="2"><br /></font></tt><br /><font face="sans-serif"></font><img src="http://www.ibsplc.com/images/email_footer_final.gif" /> <font color="#999999" face="Tahoma"size="1"><u> DISCLAIMER:</u></font> <font color="#999999" face="Tahoma" size="1"> "The information in thise-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/orprivileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies ofthe original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completenessof 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."</font><br /><font size="1"> </font>