使用当前group_by作为select语句的别名

时间:2015-02-05 23:09:35

标签: mysql sql select group-by

我有以下查询:

SELECT 
      SUM(queries), 
      unique_identifier 
FROM table_name GROUP BY unique_identifier

有没有办法按值将当前组作为SUM()的别名

示例:

SELECT 
     SUM(queries) AS unique_identifier 
FROM table_name GROUP BY unique_identifier

SELECT 
     SUM(queries) AS unique_alias 
FROM table_name GROUP BY unique_identifier AS unique_alias

预期结果应为:

SUM(), unique_alias_1
SUM(), unique_alias_2
SUM(), unique_alias_3

0 个答案:

没有答案