Actually let me reword this because Tomi's answer won't quite work.  The
table has a field called Rating.  A number 1 is stored to represent positive
a 2 is stored for neutral and a 3 is stored for negative.  I need to query
that will query up all the number 1's (positives) and subtract all the
number 3's (negatives) to give me a true rating.  Any ideas?


----- Original Message -----
From: "Tomi Junnila" <[EMAIL PROTECTED]>
To: "mySQL Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, January 19, 2001 10:32 AM
Subject: Re: HELP with SQL statement


> * Mike Podlesny <[EMAIL PROTECTED]> wrote on 19.01.01 17:25:
> > I have a table called RATING and two fields one called POSITIVE and the
> > other called NEGATIVE.  I need to write an SQL statement for my mySQL
> > database that will return the value of the total of POSITIVEs minues the
> > total of the NEGATIVEs.
>
> Err, how about
>
> select sum(positive-negative) from rating;
>
> ?
>
>
> --
> Tomi Junnila <[EMAIL PROTECTED]>
> http://www.badzilla.net/~topeju/
> Electronics and Information Technology,
> University of Turku, Finland
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to