diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs index 875708c76..4215959d5 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs @@ -178,6 +178,11 @@ namespace SqlSugar var select = copyContext.Result.GetString(); if (dic.Count > 0 && appendColumns.Count == 0) { + if (copyContext.Parameters?.Any()==true) + { + this.Context.Parameters.AddRange(copyContext.Parameters); + select = select.Replace("), AS", ") AS"); + } return select + ",@sugarIndex as sugarIndex"; ; } else if (dic.Count > 0 && appendColumns.Count > 0)