diff --git a/grid-proxy/internal/explorer/db/postgres.go b/grid-proxy/internal/explorer/db/postgres.go index 8e9e4d28f..4b7ae2835 100644 --- a/grid-proxy/internal/explorer/db/postgres.go +++ b/grid-proxy/internal/explorer/db/postgres.go @@ -254,7 +254,7 @@ func (d *PostgresDatabase) GetStats(ctx context.Context, filter types.StatsFilte } if err := d.gormDB.WithContext(ctx).Table("node"). - Select("SUM(COALESCE(workloads_number, 0)) as workloads_number"). + Select("COALESCE(SUM(workloads_number), 0) as workloads_number"). Where(condition). Joins("LEFT JOIN node_workloads ON node.twin_id = node_workloads.node_twin_id"). Scan(&stats.WorkloadsNumber).Error; err != nil {