Re: [INTERFACES] jdbc question - Mailing list pgsql-interfaces

From Joe Shevland
Subject Re: [INTERFACES] jdbc question
Date
Msg-id 005001bf73f7$f81b0560$d58427cb@kpi.com.au
Whole thread Raw
In response to jdbc question  (Phillip Rhodes <rhodespc@bellatlantic.net>)
List pgsql-interfaces
You could try:

---
SELECT test1.col1 AS t1c1, test2.col1 AS t2c1 FROM test1, test2 WHERE test1.col1 = test2.col1
---

The 'AS' being the important bit there as it will alias the parameters. I am
not sure whether rs.getInt("test1.col1") would work and I cannot test this
quickly where I am... anyone else?


Cheers,
Joe

----- Original Message ----- 
From: "Phillip Rhodes" <rhodespc@bellatlantic.net>
To: <pgsql-interfaces@postgreSQL.org>
Sent: Wednesday, February 09, 2000 7:50 AM
Subject: [INTERFACES] jdbc question


> 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
> 
> The call
> rs.getInt("col1") returns successfully with a value, but there are 2 col1 
> columns in the resultset.
> 
> Thanks,
> Phillip
> 
> 
> ************
> 
> 



pgsql-interfaces by date:

Previous
From: "Bryan White"
Date:
Subject: How to get remote ip address is stored proceedure
Next
From: Tomaz Borstnar
Date:
Subject: pgAdmin on NT (NT4SP6)