Re: [INTERFACES] jdbc question

From: "Joe Shevland" <shevlandj(at)kpi(dot)com(dot)au>
To: "Phillip Rhodes" <rhodespc(at)bellatlantic(dot)net>, <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] jdbc question
Date: 2000-02-10 18:52:23
Message-ID: 005001bf73f7$f81b0560$d58427cb@kpi.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bellatlantic(dot)net>
To: <pgsql-interfaces(at)postgreSQL(dot)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
>
>
> ************
>
>

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jason Doller 2000-02-10 19:25:17 Need Help with pgsql
Previous Message Brian Piatkus 2000-02-10 17:18:27 ODBC Declare/fetch & VB