goqu icon indicating copy to clipboard operation
goqu copied to clipboard

Sql server using Limit() with Distinct() wrong order

Open CKehToh opened this issue 4 years ago • 1 comments

Describe the bug when distinct() and limit(1) is used together, sql generated is

SELECT TOP (1) DISTINCT 

To Reproduce Use distinct and limit clause together with dialect sqlserver

.Distinct().Limit(1)

Expected behavior sql generated should be

SELECT  DISTINCT TOP (1)

Dialect:

  • [x] sqlserver
  • [ ] mysql
  • [ ] sqlite3

CKehToh avatar Nov 17 '20 11:11 CKehToh

I have raised a PR that I think would solve the problem https://github.com/doug-martin/goqu/pull/242

CKehToh avatar Nov 17 '20 14:11 CKehToh