I don't see how this SQL could return 4 rows, let alone a whole
table. It should return _one number_. You're asking the DBMS
to find all rows where the description is one of three possible
values, then for each row add together the numbers in three of
the columns, then to add together all these numbers and pass
back the result as "grandtotal".

Is that what you want?

Nick

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


well I have tested by even removing it to make it membernumber=1000017 And
hard code it because i was worried about the OR as well.
But with the ( ) its fine but even with  just membernumber=1000017 it pulls
back everyrecord

So i guess this is a bug? is there another way to do the same thing?


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


> The SUM function really has nothing to do with how many records your
> bringing back. Be careful with the "or" clause, this query is going to
> bring back EVERY combination of the  "membernumber/description" values
> listed below.
>
>
> ----- Original Message -----
> From: William J Wheatley <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 11, 2000 10:11 AM
> Subject: URGENT: SUM() QUESTION
>
>
> > This is a multi-part message in MIME format.
> >
> > ------=_NextPart_000_0123_01C01BE1.14ED4720
> > Content-Type: text/plain;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Question, i'm using sum(pic + sic + student) as grandtotal
> >
> > and when i run the query its returning the WHOLE table instead of jsut
> =
> > the
> > values i want in the where clause
> >
> > select sum(pic + sic + student) as grandtotal
> > from aeps.dbo.flighttimes
> > where membernumber=3D1000017 and (description=3D'M RECP' or =
> > description=3D'M TJET'
> > or description=3D'M TPRP')
> >
> > Its returning the whole database instead of just the 4 records it
> shoudl =
> > be
> > returning
> > now the SUM function is adding properly but i dont wnat all those =
> > records
> > returned.
> > Is there another faster way to do this then using SUM()?
> >
> > This is driving me crazy and its important
> > thanks guys!
> >
> > ICQ: 417645
> >
> > Bill Wheatley
> > Senior Developer
> > AEPS INC
> > http://www.aeps.com=20
> > http://www.aeps2000.com
> > 954-472-6684 X303
> >
> > ------=_NextPart_000_0123_01C01BE1.14ED4720
> > Content-Type: text/html;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <DEFANGED_META content=3D"text/html; charset=3Diso-8859-1" =
> > http-equiv=3DContent-Type>
> > <DEFANGED_META content=3D"MSHTML 5.00.3105.105" name=3DGENERATOR>
> > <DEFANGED_STYLE></STYLE>
> > </HEAD>
> > <BODY bgColor=3D#ffffff>
> > <DIV><FONT size=3D2>Question, i'm using sum(pic + sic + student) as=20
> > grandtotal<BR><BR>and when i run the query its returning the WHOLE
> table =
> > instead=20
> > of jsut the<BR>values i want in the where clause<BR><BR>select sum(pic
> + =
> > sic +=20
> > student) as grandtotal<BR>from aeps.dbo.flighttimes<BR>where=20
> > membernumber=3D1000017 and (description=3D'M RECP' or description=3D'M
> =
> > TJET'<BR>or=20
> > description=3D'M TPRP')<BR><BR>Its returning the whole database instead
> =
> > of just=20
> > the 4 records it shoudl be<BR>returning<BR>now the SUM function is =
> > adding=20
> > properly but i dont wnat all those records<BR>returned.<BR>Is there =
> > another=20
> > faster way to do this then using SUM()?<BR><BR>This is driving me crazy
> =
> > and its=20
> > important<BR>thanks guys!<BR><BR>ICQ: 417645<BR></FONT></DIV>
> > <DIV><FONT size=3D2>Bill Wheatley<BR>Senior Developer<BR>AEPS
> INC<BR><A=20
> > href=3D"http://www.aeps.com">http://www.aeps.com</A> <BR><A=20
> >
> href=3D"http://www.aeps2000.com">http://www.aeps2000.com</A><BR>954-472-6
> =
> > 684=20
> > X303</FONT></DIV></BODY></HTML>
> >
> > ------=_NextPart_000_0123_01C01BE1.14ED4720--
> >
> > -----------------------------------------------------------------------
> -------
> > 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.


**********************************************************************
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.

Reply via email to