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.