diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs index 8d76d85bf..1878ad8a7 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs @@ -491,7 +491,7 @@ namespace SqlSugar } public string GetSqlQuerySql(string result) { - if (this.IsSqlQuery && (Skip == null && Take == null)) + if (this.IsSqlQuery && (Skip == null && Take == null)&&(this.WhereInfos==null||this.WhereInfos.Count==0)) { var old = result; var regex = @"^SELECT .* FROM \(((.|\n|\r)*)\) t $";