Access field from joined table?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ernschd666
Posts: 11
Joined: Wed 15 Jul 2015 11:54

Access field from joined table?

Post by ernschd666 » Wed 15 Jul 2015 12:10

Hi,

let's assume I have two tables:
  • * customer with id and name and
    * orders with id, customer id, (product) name and order number.
My query is something like this:

Code: Select all

SELECT * FROM customer LEFT JOIN customer ON customer.id = customerid
In Sql I can get the value of the product name with "orders.name" (because name is ambiguous).
When I'm working with UniDAC I have to use something like "name_1" which is not really comfortable.
Is there a better way? For example TUniQuery.Table('orders').FieldByName('name').AsString

Thank you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Access field from joined table?

Post by AlexP » Wed 15 Jul 2015 15:14

Hello,

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.

Post Reply