[Lazarus] Zeos Component Join Query

Massimo Fazzolari reinhardt1053 at gmail.com
Tue Jan 12 19:01:48 CET 2010


Thank you JoshyFun!

The problem remain. Now i can't apply any filter to Invoices fields! :(

For example this query raise an exception:

"SELECT Invoices.*, Customers.Name
 FROM Customers
 RIGHT JOIN Invoices
 ON Invoices.CustomerID= Customers.ID
* WHERE Invoices.Number > 3"*



2010/1/12 JoshyFun <joshyfun at gmail.com>

> Hello Lazarus-List,
>
> Tuesday, January 12, 2010, 6:07:37 PM, you wrote:
>
> MF> I got an *sql logic error* trying to execute following query using Zeos
> MF> Component (ZQuery):
> MF> "SELECT Invoices.*, Customers.Name
> MF>  FROM Invoices
> MF>  LEFT JOIN Customers
> MF>  ON Invoices.CustomerID= Customers.ID
> MF> * WHERE Customers.Name = 'Tom' "*
> MF> excluding the Where clause make the query run without problems.
>
> >From my point of view it is a "SQL logic error", I think it should be:
>
> "SELECT Invoices.*, Customers.Name
>  FROM Customers
>  RIGHT JOIN Invoices
>  ON Invoices.CustomerID= Customers.ID
>  WHERE Customers.Name = 'Tom' "
>
> Note the swapping of Customers and Invoices, the other way the SQL
> engine will sequentially scan all invoices to join them with customer
> and perform the "where". Anyway I do not know why ZQuery raises and
> exception :-? (I'm not using Zeos at all).
>
> --
> Best regards,
>  JoshyFun
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100112/93938711/attachment-0004.html>


More information about the Lazarus mailing list