Reputation: 579
I have a select which joins the 2 tables, so there are columns with similar names from these tables, so now when retrieving the results FireDac adds underscore 1 to the 2nd column name to differentiate between the 2
Select * from Table1 inner join Table2 on
Table1.id = Table2.id
When getting records from fields with similar names I would have to do this...
Dataset.FieldByName('Name').asInteger
Dataset.FieldByName('Name_1').asInteger
I would like to know if there is a setting to change the _1 to something else, reason I want to change this is that we used to use Interbase which added just a 1.
Upvotes: 2
Views: 410
Reputation: 21252
I'm not aware of such configuration. only option I can think of is not to use SELECT *
but select the columns that you actually need with aliases for the same column names e.g.
SELECT Table1.Name, Table2.Name AS Name1, ... from Table1 inner join Table2 on
Table1.id = Table2.id
or, if you need all columns from Table1
and you must use SELECT *
you can use:
SELECT Table1.*, Table2.Name AS Name1, ...
See also: Why is “Select * from table” considered bad practice
Upvotes: 1
Reputation: 45243
Don't use select * from
. Name the columns you want to fetch, define aliases for them and use their table names (or their aliases) to create unique names.
select t1.Name as Name1, t2.Name as Name2 from Table1 t1 inner join Table2 t2 on t1.Name = t2.Name
You will now be able to get their values this way
Dataset.FieldByName('Name1').asInteger;
Upvotes: 0