All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
  Print view

Sums of Columns in table
Author Message
PostPosted: Thu Jan 07, 2010 2:54 pm 
Offline
New Coder

Joined: Thu Jan 07, 2010 2:48 pm
Posts: 1
i have a table that gets its numerical values from the user to be stored but on the display table i need another table to sum the Columns of each field, how can i accomplish his i can provide examples of what i have


Top
 Profile E-mail  
 

Re: Sums of Columns in table
PostPosted: Fri Jan 08, 2010 11:15 pm 
Offline
Site Admin

Joined: Tue Sep 09, 2008 5:29 pm
Posts: 52
if I understand you right you have for example a table that has something like the following setup:

ID (primary key)
UserID
value1
value1

etc etc

and you would probably like to list something like the sum of all entries where UserID=1 for example ie many records within the table matching single id's etc.

so in the case of above you'd use a query something like

SELECT SUM(value1), SUM(value2) FROM `table` WHERE UserID=1

this would return you the sum of column value1 and value2 where the userid matches that of the input userid.

If you post the layout of your table and the columns you want the sum of I'll be able to provide you a more accurate statement but this should hopefully be enough to point you in the right direction

_________________
CDOSYS & CDONTS auto detecting mail function: Mail Function
500.100.asp debug page: Debug Script


Top
 Profile E-mail  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron