Page 1 of 1

Access field from joined table?

Posted: Wed 15 Jul 2015 12:10
by ernschd666
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.

Re: Access field from joined table?

Posted: Wed 15 Jul 2015 15:14
by AlexP
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.