>Since one person can be listed in both 1 and 2 in each section (just not
>in the same row) I need to sum up that person's votes between the two
>columns.  I've tried summing two subqueries but it errors out because of
>returning two values. 

Unclear. Where is a user's 1 or 2 recorded? What is a "sum .. between two columns"?

PB

-----

Mazur Worden, Kathy wrote:
I'd like to sum up values from two different columns in one table that
is constructed like this:

 

CREATE TABLE `nominations`

 ( `id` smallint(5) unsigned NOT NULL auto_increment, 

`name` varchar(255) default NULL, 

`SectionA_Nominee1` varchar(255) NOT NULL default 'n/a', 

`SectionA_Nominee2` varchar(255) NOT NULL default 'n/a', 

`SectionB_Nominee1` varchar(255) NOT NULL default 'n/a',

 `SectionB_nominee2` varchar(255) NOT NULL default 'n/a'

`submittedwhen` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP, `submittedfrom` varchar(50) NOT NULL default
'unavailable', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1

 

The table has a row added each time a vote is cast.  For each section
one or two votes can be placed from a list of 4 nominees.

 

Since one person can be listed in both 1 and 2 in each section (just not
in the same row) I need to sum up that person's votes between the two
columns.  I've tried summing two subqueries but it errors out because of
returning two values.  

 

Any other ways to accomplish this?

 

Kathy Mazur Worden

Prairie Area Library System

 


  

No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.8/380 - Release Date: 6/30/2006