Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-01 : 07:57:12
|
| Nazmeera writes "Im trying to display the SUM of a column in a datase, but not all the values in that column, only the values that pertain to a criteria that i search on, ay for instance only 20 000 records had to be summed and not the rest of the values in that column of the table. The column has 120 000 fields running down and i ony want a certain amount to be SUMMED. How do i do this, cos when i use the SUM function at the moment, its giving me he SUM of the entire COLUMN and i DONT WANT that. URGENTLY require help." |
|
|
dsdeming
479 Posts |
Posted - 2002-07-01 : 08:27:10
|
| You can use the WHERE clause to control the rows aggregated by the SUM function:SELECT SUM( quantity )FROM tableWHERE condition = true |
 |
|
|
|
|
|