- 优化 SqlServer2005 TOP 1 查询;

This commit is contained in:
2881099 2022-11-17 18:15:44 +08:00
parent 1d06f677e4
commit d1a6e30644
3 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ namespace FreeSql.Custom.SqlServer
if (_limit > 0 || _skip > 0)
{
if (string.IsNullOrEmpty(_orderby))
if (string.IsNullOrEmpty(_orderby) && (_limit > 1 || _skip > 0)) //TOP 1 不自动 order by
{
if (string.IsNullOrEmpty(_groupby))
{

View File

@ -45,7 +45,7 @@ namespace FreeSql.Odbc.SqlServer
if (_limit > 0 || _skip > 0)
{
if (string.IsNullOrEmpty(_orderby))
if (string.IsNullOrEmpty(_orderby) && (_limit > 1 || _skip > 0)) //TOP 1 不自动 order by
{
if (string.IsNullOrEmpty(_groupby))
{

View File

@ -45,7 +45,7 @@ namespace FreeSql.SqlServer.Curd
if (_limit > 0 || _skip > 0)
{
if (string.IsNullOrEmpty(_orderby))
if (string.IsNullOrEmpty(_orderby) && (_limit > 1 || _skip > 0)) //TOP 1 不自动 order by
{
if (string.IsNullOrEmpty(_groupby))
{