fix mysql sql for nullable field