Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL-按函数分组使用round()_Mysql_Sql_Group By_Rounding - Fatal编程技术网

MySQL-按函数分组使用round()

MySQL-按函数分组使用round(),mysql,sql,group-by,rounding,Mysql,Sql,Group By,Rounding,在MySQL中,如何在GROUPBY函数中使用round()函数?我尝试过的示例: Table 1 a b 1.3 5 1.4 6 2.7 8 3.0 9 Select round(a,0), avg(b) from Table1 group by round(a,0) 理想情况下,这将为我提供如下输出: round(a,0) avg(b) 1 5.5 3 8.5 但这是行不通的。有什么想法吗 我在Mac上使用S

在MySQL中,如何在GROUPBY函数中使用round()函数?我尝试过的示例:

Table 1
a     b
1.3   5
1.4   6
2.7   8
3.0   9

Select round(a,0), avg(b)
from Table1
group by round(a,0)
理想情况下,这将为我提供如下输出:

round(a,0)    avg(b)
1             5.5
3             8.5
但这是行不通的。有什么想法吗


我在Mac上使用Sequel Pro,我在MacHow上使用Sequel Pro,我们应该知道你的“不工作”是什么意思吗?很好,答案是它基本上永远运行。我不确定我是否不够耐心,因为这是一个大数据集,但我让它运行了一个小时,它从未给我输出。什么是“大数据集”?100 TB?100Pb?你能修改原来的问题来解决真正的问题吗?我看不出“不工作”如何等于“永远运行”。您的查询在您提供的小样本数据上运行良好。请看这里的小提琴: