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

2010-03-30 Thread Thomas Kellerer
Snyder, James, 29.03.2010 18:25: Thanks for all the dialog on this subject. My "version" was derived from the postgreSQL's .jar file (specifically named "postgresql-8.4-701.jdbc4.jar") that I'm using. When I do the following: select version() I get the following: PostgreSQL 8.3.6 Then you

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

2010-03-29 Thread Snyder, James
ng to check this out. Thanks...Jim -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Thomas Kellerer Sent: Friday, March 26, 2010 3:15 AM To: pgsql-sql@postgresql.org Subject: Re: [SQL] SQL syntax rowcount value as an extra colu

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

2010-03-26 Thread Thomas Kellerer
Jayadevan M, 26.03.2010 07:56: Thank you for setting that right. Apologies for not checking version. The orginal poster stated that he is using 8.4, so that solution will work for him. Thomas -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription:

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

2010-03-25 Thread Jayadevan M
Hi, >It works, but you should use a recent version: >test=*# select count(1) over (), i from foo; > count | i >---+ > 8 | 1 > 8 | 2 > 8 | 3 > 8 | 6 > 8 | 7 > 8 | 9 > 8 | 13 > 8 | 14 >(8 rows) > test=*# select version(); >

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

2010-03-25 Thread A. Kretschmer
In response to Jayadevan M : > Hi, > I don't think so. > Oracle - > SQL> select count(*) over () as ROWCOUNT , first_name from people; > > ROWCOUNT FIRST_NAME > -- > - > --- > 6 Mary

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

2010-03-25 Thread Jayadevan M
Regards, Jayadevan From: Thomas Kellerer To: pgsql-sql@postgresql.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-ow...@postgresql.org Snyder, James wrote on 25.03.2010 22:33: > I’m using Postg

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

2010-03-25 Thread Jayadevan M
such a query (cartesian join) Regards, Jayadevan From: "Snyder, James" To: Date: 26/03/2010 03:21 Subject: [SQL] SQL syntax rowcount value as an extra column in the result set Sent by:pgsql-sql-ow...@postgresql.org Hello I’m using PostgreSQL (8.4.701) and

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

2010-03-25 Thread Thomas Kellerer
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

[SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-25 Thread Snyder, James
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

Re: [SQL] SQL syntax I've been unable to figure out....

2008-12-25 Thread Rodrigo E. De León Plicet
2008/12/25 Karl Denninger : > Assuming a table containing: > > name text > address text > uri text > > I wish to run a query that will return those rows where: > > ("name" is not null) AND (distinct) (uri is the same for two or more entries > AND name is different between the two entries)) > > Exam

[SQL] SQL syntax I've been unable to figure out....

2008-12-25 Thread Karl Denninger
for the following Assuming a table containing: name text address text uri text I wish to run a query that will return those rows where: ("name" is not null) AND (distinct) (uri is the same for two or more entries AND name is different between the two entries)) Example data: george who 1 sa

Re: [SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-06 Thread Tom Lane
I wrote: > There's nothing particularly stopping us from supporting > multiple-argument aggregates, except a lack of round tuits. BTW, you can actually fake this pretty well in 8.0, by making an aggregate that uses a rowtype input. For example: regression=# create type twostrings as (s1 text, s2

Re: [SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-06 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Thu, 5 Aug 2004, Ram Nathaniel wrote: >> 2) aggregated concatenation: > Theoretically, you should be able to do this right now in PostgreSQL with > user defined aggregates (although you can't pass a second argument > currently for the separator). The

Re: [SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-05 Thread Stephan Szabo
On Thu, 5 Aug 2004, Ram Nathaniel wrote: > > 1) The operator "of max": > suppose I have a table "grades" of 3 fields: class/student/grade where I > store many grades of many students of many classes. I want to get the > name of the highest scoring student in each class. Note that there may > be m

[SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-05 Thread Ram Nathaniel
Hi,   I am a developer working with many databases, as a part of my job. I use heavy SQL queries and have become somewhat of an expert in SQL, including tricks and workarounds of the limitation of the language.   I feel like a lot of the workarounds could be avoided with adding a few new ope

Re: [SQL] SQL Syntax problem

2003-09-30 Thread pginfo
Hi Doris, In oracle (+) is left outer join or right outer join . You need to write: select... fromauswahlkatalog k, beteiligter b left outer join anspruchkorrektur a on(b.bet_id = a.bet_idemp) left outer join v_betkorr f on (a.ask_id = f.ask_id) where k.awk_id = a.awk

Re: [SQL] SQL Syntax problem

2003-09-30 Thread Gaetano Mendola
sad wrote: select... fromauswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp and a.ask_id = f.ask_id(+) This (+) means JOIN Means OUTER JOIN but I don't remember the side. e.g.

Re: [SQL] SQL Syntax problem

2003-09-29 Thread sad
> I've got a problem in porting the following select statement from Oracle to > Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the > where clause: (+) > I don't know what these characters mean and how I can transform these into > PostgreSql Syntax. > > > select... >

Re: [SQL] SQL Syntax problem

2003-09-29 Thread Franco Bruno Borghesi
This kind of conditions are left or right joins, depending on which side of the equal sign you have the (+). Something like this select    ... from auswahlkatalog k, INNER JOIN anspruchkorrektur a ON (k.awk_id = a.awk_id), LEFT JOIN beteiligter b ON (b.bet_id = a.bet_idemp), RIGHT JOI

[SQL] SQL Syntax problem

2003-09-29 Thread Doris Bernloehr
Hello. I've got a problem in porting the following select statement from Oracle to Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the where clause: (+) I don't know what these characters mean and how I can transform these into PostgreSql Syntax. select... from

Re: [SQL] SQL syntax for concating values in different rows together

2002-12-10 Thread Joe Conway
Elizabeth O'Neill's Office Mail wrote: I have two tables in my database a complaint table and a resolution table. One complaint may have several resolutions. I am trying to build a report that will give me the complaint details and all the resolution descriptions for a complaint in one text area/r

Re: [SQL] SQL syntax for concating values in different rows together

2002-12-10 Thread Roberto Mello
On Tue, Dec 10, 2002 at 12:27:34PM +, Elizabeth O'Neill's Office Mail wrote: > Hi > > Can someone please help me. > > I have two tables in my database a complaint table and a resolution table. > One complaint may have several resolutions. I am trying to build a report > that will give me the

[SQL] SQL syntax for concating values in different rows together

2002-12-10 Thread Elizabeth O'Neill's Office Mail
Hi Can someone please help me. I have two tables in my database a complaint table and a resolution table. One complaint may have several resolutions. I am trying to build a report that will give me the complaint details and all the resolution descriptions for a complaint in one text area/row (co

Re: [SQL] SQL syntax

2002-08-09 Thread Jean-Luc Lachance
Well It's Friday and I am still geting vacation messages from Bob Tom Lane wrote: > > Jean-Luc Lachance <[EMAIL PROTECTED]> writes: > > Can someone *please* temporarely remove > >"Bob Powell" <[EMAIL PROTECTED]> > > from the list so we do not get a vacation message for eve

Re: [SQL] SQL syntax

2002-07-31 Thread Stephan Szabo
On Wed, 31 Jul 2002, Mindaugas Riauba wrote: > > I have two similar tables with host and services availability > data (Nagios). And I want to find out services which are not OK > in first table and OK in second one. Query I used is: > > select c.* from coll_servicestatus as c inner join > serv

[SQL] SQL syntax

2002-07-31 Thread Mindaugas Riauba
I have two similar tables with host and services availability data (Nagios). And I want to find out services which are not OK in first table and OK in second one. Query I used is: select c.* from coll_servicestatus as c inner join servicestatus as s on (c.service_description=s.service_descript

Re: [SQL] SQL Syntax / Logic question

2001-10-08 Thread Thurstan R. McDougle
To help you understand SQL I should point out that your version would work (assuming only 1 school per person) if you just left the friends out of the FROMs for the sub-selects:- select frienda, friendb from friends where (select schools.school from schools as schoolsa where friends.frienda = sc

Re: [SQL] SQL Syntax / Logic question

2001-10-04 Thread Josh Berkus
Mike, > select frienda, friendb from friends where (select > schools.school from friends,schools where friends.frienda = > schools.person) = (select schools.school from friends,schools where > friends.friendb = schools.person); Too complicated. You need to learn how to use JOINS and table alias

[SQL] SQL Syntax / Logic question

2001-10-04 Thread Michael D. Harlan
I've been working on this SQL problem for about 12 days now and have asked for help from friends/colleagues, but haven't found a solution. I send it to this list as a last resort. Let's say I have a table called "friends" and in this table, I have the following data: FriendA FriendB --- -