In this query there are two different tables Customer and table_1. So there will be no problem with same column names in two different tables. As you are not having two column names same in one table
I can’t think of a way to do automatic column aliasing…I guess you could manually update affected objects so the definition is Customer.Name “Customer_Name” (depending on what database this is)
I can’t remember where I read it but I’m sure there was a setting which made Bobj append table aliases for queries. I was getting annoyed when the SQL generated had lots of unnecessary aliases and I’m sure I found a way to stop it doing that.
But I can’t remember how. Not much use really. I’ll think on it …
Well, it’s really hackish, but what if you put the alias name in the object definition? That is, “table__1.name as spouse_name”. Most databases will complain about an alias in GROUP BY but maybe Denodo doesn’t.
Well… it doesn’t support aliases in group by clauses, but it supports group by with column index(group by 1, 2, 3) and there is a parameter for that in the prm file (YES)
Gave it a try, it seems to work :
Added an “as xxxx” in every select definition that exists more than once
enabled the group by column index
So far so good…
Select
Customer.Name,
Table__1.Name as Spouse,
count(*) as Dummy_count
from
Customer,
Customer Table__1,
where
Customer.Spouse_ID = Table__1.ID
group by
1,
2