List:General Discussion« Previous MessageNext Message »
From:Ahmad Al-Twaijiry Date:September 18 2006 9:28pm
Subject:SUM in WHERE
View as plain text  
Hi everyone

I didn't find any maillist regarding SQL question so I'm posting my question
in here.

I have a table like this

[ ID ][ Total ]
[ 1  ][  20     ]
[ 2  ][  30     ]
[ 3  ][  40     ]
[ 4  ][  10     ]
[ 5  ][  20     ]
[ 6  ][  20     ]


I want to run SQL query that will return to me the first records that the
SUM of Total field = 100

for example

SELECT * FROM tbl_name WHERE SUM(Total)=100 ORDER BY ID

I know my SQL statment above will not work, could someone help me ?




-- 

Ahmad Fahad AlTwaijiry

Thread
SUM in WHEREAhmad Al-Twaijiry18 Sep
  • AW: SUM in WHEREAndré Hänsel18 Sep
    • Re: SUM in WHEREAhmad Al-Twaijiry18 Sep
  • Re: SUM in WHEREEdward Macnaghten18 Sep
    • Re: SUM in WHEREAhmad Al-Twaijiry19 Sep
      • Re: SUM in WHEREAhmad Al-Twaijiry19 Sep
        • RE: SUM in WHERERandall Price19 Sep
          • Re: SUM in WHEREAhmad Al-Twaijiry19 Sep
  • Re: SUM in WHEREFelix Geerinckx21 Sep
    • Re: SUM in WHEREAhmad Al-Twaijiry24 Sep
RE: SUM in WHEREQuentin Bennett19 Sep
  • Re: SUM in WHEREDouglas Sims20 Sep
    • Re: SUM in WHEREAhmad Al-Twaijiry24 Sep
      • Re: SUM in WHEREDouglas Sims24 Sep
        • Re: SUM in WHEREAhmad Al-Twaijiry24 Sep
          • Re: SUM in WHEREDouglas Sims25 Sep
            • Re: SUM in WHEREAhmad Al-Twaijiry25 Sep
              • Re: SUM in WHEREPeter Brawley25 Sep
  • adding columns to a large tableHelen M Hudson25 Sep
    • Re: adding columns to a large tableEhrwin Mina25 Sep
      • RE: adding columns to a large tableMugunthan SIFY25 Sep
        • RE: adding columns to a large tableOw Mun Heng25 Sep
    • Re: adding columns to a large tablepraj25 Sep
  • Re: adding columns to a large tableHelen M Hudson25 Sep