mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Only group by if using having clauses (#1750)
* Only group by if using having clauses * Change tag sorting SQL * Add sorting unit tests
This commit is contained in:
@@ -238,8 +238,8 @@ func (r *repository) buildQueryBody(body string, whereClauses []string, havingCl
|
||||
if len(whereClauses) > 0 {
|
||||
body = body + " WHERE " + strings.Join(whereClauses, " AND ") // TODO handle AND or OR
|
||||
}
|
||||
body = body + " GROUP BY " + r.tableName + ".id "
|
||||
if len(havingClauses) > 0 {
|
||||
body = body + " GROUP BY " + r.tableName + ".id "
|
||||
body = body + " HAVING " + strings.Join(havingClauses, " AND ") // TODO handle AND or OR
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user