I set the variable up as 0 not null the val() worked a treat thanks :D
Matt ----- Original Message ----- From: "EWS" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 23, 2004 11:30 AM Subject: Re: [ cf-dev ] Monday SQL question > Also, bear in mind that you may have a null value so obviously adding a > null to the grand total is not acceptable. > > Try > > <cfset grandtotal = grandtotal + Val(Qry.total)> > > On Mon, 23 Feb 2004 10:13:59 +0200, Matt Horn <[EMAIL PROTECTED]> wrote: > > > the SQL statement works > > > > I get a variable out called qry.total > > > > but when I do > > <cfset grandtotal = grandtotal + Qry.total> > > I get the type mismatch > > > > ----- Original Message ----- > > From: "EWS" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, February 23, 2004 10:04 AM > > Subject: Re: [ cf-dev ] Monday SQL question > > > > > >> Are you sure its the sum causing the error and not the yearid or monthid > >> > >> On Mon, 23 Feb 2004 09:40:24 +0200, Matt Horn <[EMAIL PROTECTED]> > >> wrote: > >> > >> > Hi > >> > I have this very simple SQL query > >> > > >> > select Sum(amount) as total from tbltotals where yearID > >> > =#getyear.yearID# and monthid=#month# > >> > > >> > > >> > I loop over the query outputting #qry.total# for each month > >> > > >> > I want to keep a running total for that year > >> > > >> > but when I try to add it up I get a type mismatch error in CF > >> > > >> > I think I need to cast the total alias as a number but cant remember > >> > how :P > >> > > >> > a little help? > >> > > >> > Thanks > >> > > >> > > >> > |\--------------------/| > >> > Matt Horn > >> > Web Applications Developer > >> > Ph:+2782 424 3751 > >> > W: http://www.matt-horn.org > >> > E:[EMAIL PROTECTED] > >> > |\--------------------/| > >> > >> > >> > >> -- > >> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > >> > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> For human help, e-mail: [EMAIL PROTECTED] > >> > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
