Re: My query table aliases don't exist in my application

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Hugo Garza" <hiro2k(at)gmail(dot)com>,<pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: My query table aliases don't exist in my application
Date: 2011-02-01 22:48:00
Message-ID: 4D483940020000250003A145@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hugo Garza <hiro2k(at)gmail(dot)com> wrote:

> I'm going a complex join on 5 tables and some of them have a
> column that repeats in two tables called "name". So I created an
> alias for each table, one of them called co, and in my application
> I do a result.getString("co.name"). But the application fails
> with: "The column name co.name was not found in this ResultSet."

Try giving the result column an alias:

select co.name as co_name

Then access it by the name you have given it.

Personally, I've never seen that other usage, and would never have
expected it to work.

-Kevin

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Maciek Sakrejda 2011-02-01 22:52:27 Re: My query table aliases don't exist in my application
Previous Message Hugo Garza 2011-02-01 22:23:06 My query table aliases don't exist in my application