Gert Cuykens <gert.cuyk...@gmail.com> wrote: > select t.pid, t.txt, t.price, t.qty - IFNULL(sum(o.qty), 0) onhand_qty > from PRODUCTS t left join ORDERS o on t.pid = o.pid group by t.pid > > Works also thanks. > So you do not believe the following has a performance penalty ? > > SELECT pid, txt, price, qty-coalesce((SELECT sum(qty) FROM orders > WHERE orders.pid = products.pid),0) FROM products
I don't see why it should, but when in doubt, test and measure. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users