YAN HONG YE <yanhong...@mpsa.com> wrote: > I have a sqlite database named bb: > >> Name Price1 Price2 Slevel >> A1 23 231 NULL >> A2 22 12 NULL >> A3 21 223 NULL > > My question is: > I want to update culumn Slevel by function myfunc(): > > int myfunc(): > {int i=0; > if (price1 >12) > i++; > if (price1>30) > i++; > if (price2>20) > i++; > if (price2>30) > i++; > if (price2>80) > i++; > return i; > }
Just run this query: update bb set Slevel = (price1>12) + (price1>30) + (price2>20) + (price2>30) + (price2>80); -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users