SELECT ISNULL(MAX(id),0)+1 AS MaxId FROM TABLE ISNULL(MAX(id),0) 就是如果id为空 就返回0,然后再加1 转载于:https://www.cnblogs.com/xy0710/p/5057663.html