Hmm, let me get this right, you are just trying to add a column for every
row adding those other 3 columns together?  If so, you have to understand
that SUM() is an aggregate function and will do its operation on all the
rows in your query.  Let's say your primary key for this table is called ID,
then try adding the GROUP BY ID clause to your query, then it will sum the
three columns together making a new column called GRANDTOTAL for every row
in the database.

Justin Kidman

-----Original Message-----
From: William J Wheatley [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 11, 2000 9:14 AM
To: [EMAIL PROTECTED]
Subject: Re: URGENT: SUM() QUESTION


What is the proper syntax for a join to make sure i do them right? but even
w/o a join its messing up




Bill Wheatley
Senior Developer
AEPS INC
http://www.aeps.com
ICQ: 417645
http://www.aeps2000.com
954-472-6684 X303
----- Original Message -----
From: "DeVoil, Nick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 11, 2000 12:04 PM
Subject: RE: URGENT: SUM() QUESTION


> This is not how Sybase SQL is supposed to work!
>
> Unless there are some other parts of your query
> causing it to do a Cartesian product (ie you're
> referencing other tables but not joining to them
> properly) this is a bug.
>
> I guess you would need to do a CFLOOP and add
> the numbers up one at a time...
>
> There's something strange going on here!
>
> Nick
> -----Original Message-----
> From: William J Wheatley [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 11, 2000 5:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: URGENT: SUM() QUESTION
>
>
> linux, sybase
> Bill Wheatley
> Senior Developer
> AEPS INC
> http://www.aeps.com
> ICQ: 417645
> http://www.aeps2000.com
> 954-472-6684 X303
> ----- Original Message -----
> From: "DeVoil, Nick" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 11, 2000 11:52 AM
> Subject: RE: URGENT: SUM() QUESTION
>
>
> > Bill
> >
> > > select sum(pic + sic + student) as grandtotal
> > > from aeps.dbo.flighttimes
> > > where membernumber=1000017
> > >
> > > When i run this query in CF in SQL i get the column GRANDTOTAL () with
> the
> > > correct Values of the where but i get every row in the database
> > > so is there an alternate method of doing SUM()? I'm using CF PRO 4.51
> For
> > > Linux
> >
> >
> > This is bizarre. What DBMS?
> >
> >
> > **********************************************************************
> > Information in this email is confidential and may be privileged.
> > It is intended for the addressee only. If you have received it in error,

> > please notify the sender immediately and delete it from your system.
> > You should not otherwise copy it, retransmit it or use or disclose its
> > contents to anyone.
> > Thank you for your co-operation.
> > **********************************************************************
>
> --------------------------------------------------------------------------
> ----
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> >
>
> --------------------------------------------------------------------------
--
> --
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to