On 22 Dec 2011, at 2:52am, YAN HONG YE wrote: > I have a question about C binding for sqlite, I have a table like this: > > Name Price1 Price2 Sum > A1 23 231 > A2 22 12 > A3 21 223 > > how to use functin int sum(price1+price2) > result to put into sum cloumn use sqlite in c code?
You should not call a column "Sum" because that word is reserved in SQLite. So call it "PriceTotal" instead. UPDATE MyTable SET PriceTotal = Price1 + Price2 But there is no need to do that and store the result. Just add the two prices together whenever you want the total: SELECT (Price1 + Price2) AS PriceTotal FROM MyTable To learn how to call SQLite functions from C read the end of this page: <http://www.sqlite.org/quickstart.html> Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users