Page 1 of 1

AMBIGUOUS FIELD IN JOIN

Posted: Fri 06 Nov 2015 17:21
by Obi-Wan
Hi
ususally I access field with TMyTable component and field name, i.e.

MySqlDataset: TMyTable;
MyField : String;
....
... connect command
.....
MySqlDataset.SQL.Text:='SELECT * FROM MyTable';
MySqlDataset.execute;
MyField := MysqDataset['Fieldname']

This don't work when I have a Mysql Join COMMAND bewteen two tables, and I need to access
a field with has the same name both table, ie

MySQLDataset.text :='SELECT * FROM receivers LEFT JOIN satellites ON receivers.antenna=satellites.id ');
MySqlDataset.execute;
MyField := MysqDataset['satellites.id']

I got an error, unknow fields...

Where I'm wrong ?

Thanks alot

cu

Re: AMBIGUOUS FIELD IN JOIN

Posted: Mon 09 Nov 2015 11:26
by ViktorV
This is standard behavior for all the components and utilities. You should specify such fields explicitly in the query and create corresponding aliases for them.

Re: AMBIGUOUS FIELD IN JOIN

Posted: Mon 09 Nov 2015 13:49
by Obi-Wan
standard ?
I have got also another Delphi component for MySql who manage
my problem.....

Re: AMBIGUOUS FIELD IN JOIN

Posted: Fri 13 Nov 2015 15:10
by ViktorV
We meant the standard Delphi components. Please clarify: what components have another behavior?

Re: AMBIGUOUS FIELD IN JOIN

Posted: Mon 16 Nov 2015 12:40
by Obi-Wan
I try you component and find it great, actually I only use this.
Some days ago I start converting an old project that was developed using
another similar component, not from devart, and it works using the syntax
of my first post (i.e. MyField := MysqDataset['satellites.id']) .

So I wrote here my question. I can send you in PM the name of the component

cu

Re: AMBIGUOUS FIELD IN JOIN

Posted: Wed 18 Nov 2015 10:10
by ViktorV
Please send the name of the components to viktorv*devart*com.