I'm trying to to build an offline billing software which allows user to add new items,update price and no of stocks ECT....I have a problem in updating the no of stocks.i want to retrieve the data for no of new stock from a form and add that to the existing stock value of that particular product.i tried with sum() function also tried with ariable addition .was of no use.
Looks like you need a simple UPDATE query to add a value to an existing field, like :
UPDATE stock_table s
SET s.value = s.value + ?
WHERE s.id = ?
You want to replace the first question mark with the new stock value received from your form, and the second one with the primary key of the stock item you want to update.