不是在max中选择的单组分组功能 [英] not a single-group group function with MAX in select
本文介绍了不是在max中选择的单组分组功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Select sg_gameno, Max(sg_Year), sg_end, sg_hostcity, country_olympic_name
from Summergames s, Country co
where s.country_isocode = co.country_isocode
不知道这有什么问题.我想获得最近的一年.我应该使用MAX还是其他?
Don't know whats wrong with this. I want to get the lastest year. Should i use MAX or something else.
推荐答案
如果要聚合一个列(sg_year
),而不要聚合其他列,则需要GROUP BY
子句.
If you want to aggregate one column (sg_year
) and to not aggregate others, you need a GROUP BY
clause.
Select sg_gameno, Max(sg_Year), sg_end, sg_hostcity, country_olympic_name
from Summergames s,
Country co
where s.country_isocode = co.country_isocode
group by sg_gameno, sg_end, sg_hostcity, country_olympic_name
在语法上有效.是否为您提供所需的结果是另一个问题-您需要告诉我们表的外观,表中的数据,所需的结果等.
is syntactically valid. Whether it provides you the results you want is another question-- you'd need to tell us what your tables look like, what data is in them, what result you want, etc.
这篇关于不是在max中选择的单组分组功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文