getting funky numbers from sum()
Posted by: 11sven
Date: March 18, 2006 03:57AM

SELECT `itemProdId` , `itemProdQty` , `itemProdSize` , sizeUnitPrice, sum( `itemProdPrice` ) as calcTotal
FROM items
LEFT JOIN sizes ON itemProdId = sizeProductId
where `itemCustId` = -1
and `itemOrdId` = 36
group by itemProdId

I know there is only on one row resulting from this query and i know calcTotal should equal 1.00, i entered the pertaining data as a test row. but when i run the query calcTotal equals 4.00 ??? what gives? i have tried writing the query many different ways. the only time i can get calcTotal to equal 1.00 is when i run it as a single table query. but i want to use this in a php program and combine it into one query. and i want to find out if something is fundamentally unsound in my database. my primary keys seem to match correctly , i don't know what is going on. thanks for any help

Options: ReplyQuote

Written By
getting funky numbers from sum()
March 18, 2006 03:57AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.