playground
playground copied to clipboard
COUNT does not work with multicolumn distinct
Explain your user case and expected results
I expect count to be equal to len(result), instead if you look at the debug logger, the distinct operation is dropped altogether for count if more than a column is provided. One single column works fine as in the documentation:
db.Model(&User{}).Distinct("name").Count(&count)