Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I want to add the TotalFO and the TotalDDs colums (and call that column TotalPend250) together to get the count of how many cases are pending between 250 - 300 using getdate()Is this correct?select sum(TotalFO) + sum(TotalDDS) as TotalPend250from T16Pendallwhere DATEDIFF(day, TotalPend250, GETDATE()) > 250 and DATEDIFF(day, TotalPend250, GETDATE()) < 300
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2010-10-15 : 14:06:01
Have no idea what TotalFO and TotalDDs columns represent or their datatypes so I don't know if that is "correct" but just to translate your statement into something syntactically correct:
Well stated and a good argument. But I get that error.
select sum([col])from ( select convert(char(1), 1) as [col] union all select convert(char(1), 2) ) dOUTPUT:Msg 8117, Level 16, State 1, Line 1Operand data type char is invalid for sum operator.