======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
no, you would be trting to sum all columns (1 record) and display all rows individually.
If you want to disply the sum with each row
select (select sum(coalesce(col1,0)) + sum(colesce(col2,0)) from tbltest), *
from tbltest
you can also
select sum(coalesce(col1,0)) + sum(colesce(col2,0)), col1, col2
from tbltest
group by col1, col2
======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
I think you can't place the * character at the end of the columns, because it will include each column of the table, and the aggregate funcions won't work with individual columns unless you code each column in a Group By Clause.
Aahh, with the exception of Count(), aggregate functions ignore null values. So, you even can write:
[tt]
Select Sum(Col_1) + Sum(Cod_2)
From TableTest
[/tt]
You can do that but may get a warning depending on the ansi warnings setting. Better to cater for the null values.
======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.