It is very clear to me that my expectations are wrong, please enlighten
me...
Here is the query:
update INVOICE
set SUB_TOTAL = (select sum(PRICE * QTY) from INVOICE_ITEM ii where
ii.INVOICE_ID = *INVOICE_ID*),
TAX = (select round( sum(PRICE * QTY) * ( 8.25 / 100) + .005, 2) from
INVOICE_ITEM ii where ii.INVOICE_ID = *INVOICE_ID*),
TOTAL = (select round( sum(PRICE * QTY) * ( 1 + ( 8.25 / 100)) +
.005, 2) from INVOICE_ITEM ii where ii.INVOICE_ID = *INVOICE_ID*),
updatedby = 'manual2';
The result is that every SUB_TOTAL, TAX, and TOTAL are very large, I assume
it is the grand total. It was my impression that the INVOICE_ID on the
right of each where clause would be the current invoice_id of the given row
being updated. Am I wrong? If so, is there some way to do this update in
one update statement?
Sam
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users