Query Designer: Output column names mismatch when joins used [message #666096] |
Tue, 19 April 2011 06:32 |
Erdal Karaca 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 |
|
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 #666443 is a reply to message #666383] |
Wed, 20 April 2011 13:16 |
|
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...
|
|
|
Powered by
FUDForum. Page generated in 0.03802 seconds