HighDots Forums  

Need to sum balance columns from SQL Server

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Need to sum balance columns from SQL Server in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
_Adrian
 
Posts: n/a

Default Need to sum balance columns from SQL Server - 11-17-2004 , 05:46 PM






Anyone have a tutorial on how to use the Repeating Region behavior (or
similar) that then also allows me to sum a given field (SQL Server to
ASP/VBScript) on the page in a "Total" column?



Reply With Quote
  #2  
Old   
Julian Roberts
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-17-2004 , 06:20 PM






What you could do is create an extra recordset with some SQL like

select sum(Goals) as TotalGoals from FootyTable

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004



Reply With Quote
  #3  
Old   
_Adrian
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-17-2004 , 07:25 PM



Yeah, thats pretty much what I did.. but I wonder how I could qualify it
against a session variable or URL parameter as passed by the browser?
you know... select sum(goals) as totalgoals from footytable where U_ID =
URL param kind of a thing..



Reply With Quote
  #4  
Old   
CMBergin
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-18-2004 , 09:18 AM



That's exactly what you'd do. You'd get the sum of all records that meet
the conditions in your WHERE clause.

See, you already knew what to do.

"_Adrian" <adrianle @comcast.net> wrote

Quote:
Yeah, thats pretty much what I did.. but I wonder how I could qualify it
against a session variable or URL parameter as passed by the browser?
you know... select sum(goals) as totalgoals from footytable where U_ID =
URL param kind of a thing..





Reply With Quote
  #5  
Old   
_Adrian
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-18-2004 , 10:35 AM



ah.. ahem.. yes, but I'm afraid I don't know the exact context... I need to
know what the context is for the WHERE clause...



Reply With Quote
  #6  
Old   
CMBergin
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-18-2004 , 10:52 AM



Exactly as you described it.
SELECT SUM(yourColumn)
FROM yourTable
WHERE yourIDField = 'some value'

If you don't know how to use variables, set up the recordset in "simple"
mode as though you're selecting the column you want to add up, add your
where conditions, etc, then go to advanced mode and simply wrap the column
name in SUM as above. The rest will stay as is.

"_Adrian" <test (AT) test (DOT) com> wrote

Quote:
ah.. ahem.. yes, but I'm afraid I don't know the exact context... I need
to
know what the context is for the WHERE clause...





Reply With Quote
  #7  
Old   
_Adrian
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-18-2004 , 03:27 PM



Yeah, thats kind of the challenge that I've got.. is how to write the SELECT
statement in the recordset so that 'somevalue' equals the URL parameter..
maybe I'm making this more difficult than it needs to be... am uncertain at
this point!



Reply With Quote
  #8  
Old   
_Adrian
 
Posts: n/a

Default Re: Need to sum balance columns from SQL Server - 11-18-2004 , 03:58 PM



Yup.. I was making it too difficult.. found a way to do it in the
scripting .. [sigh]
http://www.dmxzone.com/forum/topic.asp?TOPIC_ID=12410&FORUM_ID=3&CAT_ID=2&Topic _Title=Show+the+summ+of+a+Repeated+field&Forum_Tit le=Dreamweaver+UltraDev



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.