avatar
[转载] 问个SQL问题# Database - 数据库
l*h
1
【 以下文字转载自 OnTheRoad 讨论区 】
【 原文由 laugh 所发表 】
select f1, f2, f3, sum(f4), f5 from table1 where blah blah
group by f1, f2
这个group by是不是要把所有非f4的fields都放进去?
avatar
s*m
2

You may want to do this.
select f1,f2,f3,f5,sum(f4) from table1 Where blah....
group by f1,f2,f3,f5;
I am not sure you can include f5 after sum(f4).

【在 l***h 的大作中提到】
: 【 以下文字转载自 OnTheRoad 讨论区 】
: 【 原文由 laugh 所发表 】
: select f1, f2, f3, sum(f4), f5 from table1 where blah blah
: group by f1, f2
: 这个group by是不是要把所有非f4的fields都放进去?

avatar
a*c
3

It should be fine that you put the sum() anywhere in the SELECT statement.

【在 s***m 的大作中提到】
:
: You may want to do this.
: select f1,f2,f3,f5,sum(f4) from table1 Where blah....
: group by f1,f2,f3,f5;
: I am not sure you can include f5 after sum(f4).

avatar
l*r
4
don't understand what is the question.
and don't understand why not just try it?

【在 a****c 的大作中提到】
:
: It should be fine that you put the sum() anywhere in the SELECT statement.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。