mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add alias when adding group by
This commit is contained in:
@@ -101,6 +101,9 @@ export default class PostgresQuery {
|
|||||||
var selectParts = this.target.select[i];
|
var selectParts = this.target.select[i];
|
||||||
if (!selectParts.some(part => part.type === 'aggregate')) {
|
if (!selectParts.some(part => part.type === 'aggregate')) {
|
||||||
selectParts.splice(1, 0, { type: 'aggregate', params: ['avg'] });
|
selectParts.splice(1, 0, { type: 'aggregate', params: ['avg'] });
|
||||||
|
if (!selectParts.some(part => part.type === 'alias')) {
|
||||||
|
selectParts.push({ type: 'alias', params: [selectParts[0].params[0]] });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user