pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phillip Rhodes <phillip@rhoderunner.com>
To: 'pgsql-interfaces@postgreSQL.org' <pgsql-interfaces@postgreSQL.org>
Subject: RE: [INTERFACES] jdbc question
Date: Wed, 9 Feb 2000 18:38:24 -0000
Message-ID: <01BF732C.EF5280A0.phillip@rhoderunner.com> (raw)

Is there a way to resolve this without aliases?  I would like to use some 
objects that would handle the resultset of a particular table,  and if some 
queries refer to cola as colx, there would be no way to re-use the code.

For example

select * from test1, test2

//call method to get test1
test1ResultsetHandler(resultset)

//call method to get test1
test2ResultsetHandler(resultset)



----------
From: 	Ken J. Wright[SMTP:ken@ori-ind.com]
Sent: 	Wednesday, February 09, 2000 6:17 PM
To: 	Phillip Rhodes; 'pgsql-interfaces@postgreSQL.org'
Subject: 	Re: [INTERFACES] jdbc question

At 15:50 02/09/2000 -0000, Phillip Rhodes wrote:
>If I submit a query joining two tables with identical column names, how 
can
>I differentiate the different columns and get the correct values?
>
>table test1
>(col1 INTEGER,
>col2 INTEGER)
>
>table test2
>(col1 INTEGER,
>col2 INTEGER)
>
>
>select * from test1, test2
>where test1.col1 = test2.col1

select a.*, b.col1 as col3, b.col2 as col4 from test1 a, test2 b
where a.col1 = b.col1

>The call
>rs.getInt("col1") returns successfully with a value, but there are 2 col1
>columns in the resultset.
>
>Thanks,
>Phillip
>
>
>************
>





view thread (7+ messages)  latest in thread

Message-ID: <01BF732C.EF5280A0.phillip@rhoderunner.com>
Permalink:  ../01BF732C.EF5280A0.phillip@rhoderunner.com/
Also on:    postgresql.org/message-id/01BF732C.EF5280A0.phillip@rhoderunner.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: phillip@rhoderunner.com
  Subject: RE: [INTERFACES] jdbc question
  In-Reply-To: <01BF732C.EF5280A0.phillip@rhoderunner.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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