MSSQL Sum query
- by ldb
today my problem is this i have 2 column and i wish check if the sum of that columns isn't Higher then a value(485 for example) and if is do a query...i though to do
SELECT * FROM table WHERE ColumnA+ColumnB<485
But isn't working... i've already tried with
SELECT Sum(ColumnA)+Sum(ColumnB) AS Total FROM table
but it gives me 1 column with the sum of all rows, i instead want a row for every sum. so how can i do..? xD i hope you understood if not just ask that i try to explain it better! and thanks in advice for who want to help me!
EDIT: I Found out XD the problem was that the columns was Smallint and the result of 1 or more rows was more than 32k so it wasn't working! Thanks At all!!