AMBIGUOUS FIELD IN JOIN

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Obi-Wan
Posts: 11
Joined: Tue 22 Sep 2015 08:29

AMBIGUOUS FIELD IN JOIN

Post by Obi-Wan » Fri 06 Nov 2015 17:21

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: AMBIGUOUS FIELD IN JOIN

Post by ViktorV » Mon 09 Nov 2015 11:26

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.

Obi-Wan
Posts: 11
Joined: Tue 22 Sep 2015 08:29

Re: AMBIGUOUS FIELD IN JOIN

Post by Obi-Wan » Mon 09 Nov 2015 13:49

standard ?
I have got also another Delphi component for MySql who manage
my problem.....

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: AMBIGUOUS FIELD IN JOIN

Post by ViktorV » Fri 13 Nov 2015 15:10

We meant the standard Delphi components. Please clarify: what components have another behavior?

Obi-Wan
Posts: 11
Joined: Tue 22 Sep 2015 08:29

Re: AMBIGUOUS FIELD IN JOIN

Post by Obi-Wan » Mon 16 Nov 2015 12:40

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: AMBIGUOUS FIELD IN JOIN

Post by ViktorV » Wed 18 Nov 2015 10:10

Please send the name of the components to viktorv*devart*com.

Post Reply