Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Query Designer: Output column names mismatch when joins used
Query Designer: Output column names mismatch when joins used [message #666096] Tue, 19 April 2011 06:32 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
On a join of two different tables with each having the same column names, the query's outpout column names generated by birt are useless.

E.g: I have Table A and B with each having "name" and "description" columns.
The output column names generated by birt will be "name", "description", "name_1", "description_2".
This is even true if I define an sql column alias, i.e.

select a.name "a_name", a.description "a_description",
b.name "b_name", b.description "b_description"
from a
left join b on a.id = b.a_id

I tried with the latest mysql jdbc driver. I tried H2 as well with same result.

If I press "Preview Results", then the correct names are shown in the table header.

[Updated on: Tue, 19 April 2011 06:35]

Report message to a moderator

Re: Query Designer: Ouput column names mismatch when joins used [message #666340 is a reply to message #666096] Wed, 20 April 2011 02:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Not sure if this syntax will work but I just tried this with derby and
it worked

select CLASSICMODELS.ORDERDETAILS.ORDERNUMBER as ord1,
CLASSICMODELS.ORDERS.ORDERNUMBER as ord2
from orderdetails
left join orders on CLASSICMODELS.ORDERDETAILS.ORDERNUMBER=
CLASSICMODELS.ORDERS.ORDERNUMBER

Jason

On 4/19/2011 2:32 AM, Erdal Karaca wrote:
> On a join of two different tables with each having the same column
> names, the query's oupout column names generated by birt are useless.
>
> E.g: I have Table A and B with each having "name" and "description"
> columns.
> The outout column names generated by birt will be "name", "description",
> "name1", "description2".
> This is even true if I define an sql column alias, i.e.
>
> select a.name "a_name", a.description "a_description",
> b.name "b_name", b.description "b_description"
> from a
> left join b on a.id = b.a_id
>
> I tried with the latest mysql jdbc driver. I tried H2 as well with same
> result.
>
> If I press "Preview Results", then the correct names are shown in the
> table header.
Re: Query Designer: Ouput column names mismatch when joins used [message #666383 is a reply to message #666340] Wed, 20 April 2011 09:13 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
It seems that both mysql and h2 drivers do not return the alias defined in the sql, i.e. resultMetaData.getColumnName() just returns the left side of "as" or an internally generated id (name, name_1).
Though, resultMetaData.getColumnLabel() returns the alias defined in the query...
Re: Query Designer: Ouput column names mismatch when joins used [message #666443 is a reply to message #666383] Wed, 20 April 2011 13:16 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I tried the same query in MySql and it worked for me. I am using this
jar: mysql-connector-java-5.0.4-bin.jar

Jason

On 4/20/2011 5:13 AM, Erdal Karaca wrote:
> It seems that both mysql and h2 drivers do not return the alias defined
> in the sql, i.e. resultMetaData.getColumnName() just returns the left
> side of "as" or an internally generated id (name, name_1).
> Though, resultMetaData.getColumnLabel() returns the alias defined in the
> query...
Previous Topic:How to set styles for cells and rows in a grid ?
Next Topic:IReportDocument.getGlobalVariables() deprecated
Goto Forum:
  


Current Time: Sat Apr 27 05:00:55 GMT 2024

Powered by FUDForum. Page generated in 0.03802 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top