From 4e74c80b67ab90fc6cbf040e847bcc27b27cf723 Mon Sep 17 00:00:00 2001 From: Dacian Stanciu Date: Wed, 24 Apr 2024 13:47:05 +0000 Subject: [PATCH] fix: Legacy MsSQL - legacy offset select sql command bug #2446 (#2448) fix for MsSQL legacy bug Co-authored-by: Lunny Xiao Reviewed-on: https://gitea.com/xorm/xorm/pulls/2448 Reviewed-by: Lunny Xiao Co-authored-by: Dacian Stanciu Co-committed-by: Dacian Stanciu --- internal/statements/legacy_select.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/statements/legacy_select.go b/internal/statements/legacy_select.go index c6fd86b7..23a749a7 100644 --- a/internal/statements/legacy_select.go +++ b/internal/statements/legacy_select.go @@ -19,8 +19,9 @@ func (statement *Statement) isUsingLegacyLimitOffset() bool { func (statement *Statement) writeMssqlLegacySelect(buf *builder.BytesWriter, columnStr string) error { return statement.writeMultiple(buf, statement.writeStrings("SELECT"), - statement.writeDistinct, statement.writeTop, + statement.writeDistinct, + statement.writeStrings(" ", columnStr), statement.writeFrom, statement.writeWhereWithMssqlPagination, statement.writeGroupBy,