add NULLIF in group statement because of go null values = empty string

This commit is contained in:
Danny 2018-06-08 16:00:32 +02:00
parent e2294c4b6c
commit 50c0d9ccd0

View File

@ -44,9 +44,9 @@ func (db *sqlstore) GetAggregatedReferrerStats(startDate time.Time, endDate time
WHERE date >= ? AND date <= ? `
if db.Config.Driver == "sqlite3" {
sql = sql + `GROUP BY COALESCE(groupname, hostname || pathname ) `
sql = sql + `GROUP BY COALESCE(NULLIF(groupname, ''), hostname || pathname ) `
} else {
sql = sql + `GROUP BY COALESCE(groupname, CONCAT(hostname, pathname) ) `
sql = sql + `GROUP BY COALESCE(NULLIF(groupname, ''), CONCAT(hostname, pathname) ) `
}
sql = sql + ` ORDER BY pageviews DESC LIMIT ?`