May 12, 2003 #1 clarissa1996 Technical User Joined Jan 31, 2002 Messages 78 Location CH I need to compute the sum of a column at the end of a select statement. How is this possible ? Thanks. Clarissa
I need to compute the sum of a column at the end of a select statement. How is this possible ? Thanks. Clarissa
May 13, 2003 #2 swampBoogie Programmer Joined Jan 6, 2003 Messages 1,660 Location SE You have to do that by summing in your application. Upvote 0 Downvote
May 13, 2003 #3 r937 Technical User Joined Jun 30, 2002 Messages 8,847 Location CA or use a UNION, if you have mysql 4 [tt] select "detail" , foo , bar from yourTable union all select "total" , sum(foo) , sum(bar) from yourTable order by 1[/tt] nice that the word "detail" sorts before the word "total" rudy http://rudy.ca/ Upvote 0 Downvote
or use a UNION, if you have mysql 4 [tt] select "detail" , foo , bar from yourTable union all select "total" , sum(foo) , sum(bar) from yourTable order by 1[/tt] nice that the word "detail" sorts before the word "total" rudy http://rudy.ca/