l***h 发帖数: 139 | 1 【 以下文字转载自 OnTheRoad 讨论区 】
【 原文由 laugh 所发表 】
select f1, f2, f3, sum(f4), f5 from table1 where blah blah
group by f1, f2
这个group by是不是要把所有非f4的fields都放进去? | s***m 发帖数: 28 | 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都放进去?
| a****c 发帖数: 25 | 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).
| l*********r 发帖数: 80 | 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.
|
|