[sql] SELECT max(x) is returning null; how can I make it return 0?