MySQL Forums
Forum List  »  Newbie

This is a challenging question-Counting a single rows results
Posted by: Vincent Fulco
Date: September 07, 2004 09:11PM

I've looked all over and am unable to find an answer to this problem-

Using data specifically grouped chronologically by date, I would like to create a column within the body of a larger SELECT statement which adds a few columns of data by each row.

For example, on row designated by the date 2001-01-01, column 2 data + column 3 data = column 4 results...

I've tried the following solutions with no luck-

sum(column2)+sum(column3) AS 'column4 data'

Also tried-

sum(column2+column3) AS 'column4data'

Also tried-

select sum(column2+column3) AS 'column4data'

i know column 2 and column 3 retain data properly since I can run the larger select statement w/o an attempt to sum the columns and it runs fine. I realize most of MYSQL functionality is to sum or count column data down rather than row data across post a select but I want to do the select and then count data across. Should I use an UPDATE on the table after establishing it with the data I need?

Using MYSQL 4.0...Thanks for your time...I've checked all the newsgroups and q&a websites before posting.

Best,

Vince Fulco

Options: ReplyQuote


Subject
Written By
Posted
This is a challenging question-Counting a single rows results
September 07, 2004 09:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.