pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Shevland <shevlandj@kpi.com.au>
To: Phillip Rhodes <rhodespc@bellatlantic.net>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] jdbc question
Date: Thu, 10 Feb 2000 10:52:23 -0800
Message-ID: <005001bf73f7$f81b0560$d58427cb@kpi.com.au> (raw)
References: <01BF7315.59104850.rhodespc@bellatlantic.net>

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
> 
> 
> ************
> 
> 




view thread (7+ messages)

Message-ID: <005001bf73f7$f81b0560$d58427cb@kpi.com.au>
Permalink:  ../005001bf73f7$f81b0560$d58427cb@kpi.com.au/
Also on:    postgresql.org/message-id/005001bf73f7$f81b0560$d58427cb@kpi.com.au

 · 

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: shevlandj@kpi.com.au, rhodespc@bellatlantic.net
  Subject: Re: [INTERFACES] jdbc question
  In-Reply-To: <005001bf73f7$f81b0560$d58427cb@kpi.com.au>

* 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