I would expect NULL (empty string) as the result from a max (or any other summary) query which has "no rows". Any particular value wouldn't make too much sense to me. Why any particular value? 0 doesn't really make sense. Well no more or less sense than -1 or even -10372 (picked "at random").
If you need a particular "default" value instead of a NULL, use the coalesce() function. select coalesce(max(current_rank),0) FROM playersinleague WHERE id = 1; On Sun, Nov 10, 2013 at 2:39 AM, Igor Korot <ikoro...@gmail.com> wrote: > I just tried to do: > > SELECT max(current_rank) FROM playersinleague WHERE id = 1; > > and I got an empty string and not 0. > > Is this a bug? Should max(field) return 0 if there is no records that > satisfy criteria? > > Thank you. > > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users