Skip site navigation (1) Skip section navigation (2)

RE: [INTERFACES] jdbc question

From: Phillip Rhodes <phillip(at)rhoderunner(dot)com>
To: "'pgsql-interfaces(at)postgreSQL(dot)org'" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: RE: [INTERFACES] jdbc question
Date: 2000-02-09 18:38:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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

//call method to get test1

From: 	Ken J. Wright[SMTP:ken(at)ori-ind(dot)com]
Sent: 	Wednesday, February 09, 2000 6:17 PM
To: 	Phillip Rhodes; 'pgsql-interfaces(at)postgreSQL(dot)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 
>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.

pgsql-interfaces by date

Next:From: Paul GreenDate: 2000-02-09 19:30:19
Subject: Linux+postgresql+ODBC+StarOffice
Previous:From: Knauer, Todd C.Date: 2000-02-09 17:37:39
Subject: Access2000

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group