BareFeet <[EMAIL PROTECTED]> wrote:
> I tried this:
>
> select
>   "Invoices".ID as Invoice
> , (select sum(Buy) from Moves where Moves.Invoice = Invoices.ID) as
> "Sum Buy"
> , (select sum(Delivery) from "Orders" on "Orders".ID in (select
> "Order" from Moves where Invoice = Invoices.ID)) as "Sum Delivery"
> from "Invoices"
> group by Invoice
> ;
>
> which works correctly but it seems inelegant, inefficient and in one
> test seems orders of magnitude too slow.

Drop GROUP BY clause, you don't need it here. See if it helps with 
performance.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to