#1 Re: mORMot 1 » MSSQL RESTful server/client TSQLTableJSON LEFT JOIN problem » 2016-04-19 16:47:14

Thanks for the orientation! I've been reading the documentation but have some doubts about somethings.
With your answer I can see better where to go from now to solve my problem.
Have a nice day!

#2 mORMot 1 » MSSQL RESTful server/client TSQLTableJSON LEFT JOIN problem » 2016-04-18 21:40:03

deChateau
Replies: 2

Hello, everyone.

I have a problem with LEFT JOIN query type using TSQLTableJSON by calling TSQLRestClientURI.ExecuteList in client app to a TSQLRestServerDB Server App using a TSQLDBServerHttpApi server publishing a TOleDBMSSQL2012ConnectionProperties pointing to a MS SQL Server 2014 Database. (I would prefer to use ZEOS -or UniDAC- but... I just can't make it work using ZDBC 7.2 RC 1).

My Query is like:

SELECT
  Customers.ID,
  Customers.CustomerType,
  Customers.Name,
  CustomersClasses.Name <— Her an ‘… AS OtherFieldName’ would be better
FROM
  Customers
LEFT JOIN
  CustomersClasses
ON
  CustomersClasses.Id = Customers.IdCustomerClass

When I try to call TSQLRestClientURI.ExecuteList method, internally is generated a query like:

SELECT
  Customers.ID,
  Customers.CustomerType,
  Customers.Name,
  CustomersClasses.Name
FROM
  Customers,CustomersClasses

And the result is Nil.

Code segment:
const
  strSQL  = 'Customers.ID,Customers.CustomerType,Customers.Name,CustomersClasses.Name';
begin
  ...
  MyTable   := MyRestClient.ExecuteList([TSQLCustomers,TSQLCustomersClasses], strSQL);  <-- Result is Nil
  ...

Any guidelines to solve my problem? Maybe I am not doing it well.

Thanks in advance.

Board footer

Powered by FluxBB