From 88afc71378c884d9b45860d8fa00ec5e10499d9a Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 24 Dec 2022 17:42:50 +0800 Subject: [PATCH] Update Subquery.OrderBy.ToList --- .../SqlServer/SqlBuilder/SqlServerBuilder.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBuilder.cs index 51fbbf41b..ef9c12607 100644 --- a/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBuilder.cs @@ -11,5 +11,15 @@ namespace SqlSugar { public override string SqlTranslationLeft { get { return "["; } } public override string SqlTranslationRight { get { return "]"; } } + + public override string RemoveParentheses(string sql) + { + if (sql.Contains("ORDER BY")) + { + sql = $"SELECT * FROM {sql.Replace("(SELECT ", "(SELECT TOP 1000000")} TEMP"; + } + return sql; + } + } }