PDA

View Full Version : Sqlite query to get sum of items



sue
05-30-2006, 01:58 PM
Could someone help me with totalling in Sqlite?

I am developing an invoice application. I have the invoice generating from a Sqlite database. I have one order number that could have multiple different products. What I need to do is populate the subtotal cell on a html document with the total of all the product prices for that order number.

How would I do that? My query is :

"Select (((ProdQty*ProdPrice)+ProdAdditionalCharges)-ProdDiscount) AS [GT] From OrderInfo Where OrderNumber="..orderid99

How can I get the sum of all of the GT's for that order number?

Thanks for your assistance!!

Sue

TJ_Tigger
05-30-2006, 02:25 PM
sql has a SUM function built in.

"Select SUM(GT) From OrderInfo Where OrderNumber="..orderid99

Try that.

Tigg