This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / sql query question: how to sum 1 column?
-newdriger(P0kerFan);
2008-5-13
{581}
(#4449985@0)
-
select col1, sum(col2), col3, col4
from table_name
group by col1, col3, col4
-zdq(zdq);
2008-5-13
(#4450307@0)
-
thanks. it works
-newdriger(P0kerFan);
2008-5-13
(#4450705@0)
-
If I change the contents of col4 to company1, comany2,company3,company4. then I still wanna sum(col2) by col1 with any company in the same row, is it hard to realize? thanks again
-newdriger(P0kerFan);
2008-5-13
(#4450733@0)
-
try: select col1, sum(col2), col3, min(col4) from table_name group by col1, col3
-newkid(newkid);
2008-5-13
(#4450752@0)
-
thanks. it works
-newdriger(P0kerFan);
2008-5-13
(#4450828@0)
-
we are under an emergency situation so i did not read your post, but will "sum" do?
-win(秋天的菠菜);
2008-5-13
(#4450317@0)