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 |
|
jpiscit1
Posting Yak Master
130 Posts |
Posted - 2004-11-12 : 08:36:18
|
| Hi.Select SUM(Sch1_sheets+Sch2_sheets+Sch3_sheets)From tbl_ProdScheduleWhere work_order_no = 1339 Columns Sch2_sheets AND Sch3_sheets have data for the given criteria i.e. "work_order_no = 1339"Column Sch1_sheets has null values for this criteria. How to I get SQL to SUM the totals and assume the NULL values to be zero where it exist?Currently I get a result of NULL Which I assume is becuaseNULL+3000+3000 = NULLI wantNULL+3000+3000 = 6000Thanks! |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-11-12 : 08:40:34
|
| SELECT Sum(IsNull(Sch1_sheets, 0) + IsNull(Sch2_sheets, 0) + IsNull(Sch3_sheets, 0))FROM tbl_ProdScheduleWHERE work_order_no = 1339 |
 |
|
|
jpiscit1
Posting Yak Master
130 Posts |
Posted - 2004-11-12 : 08:46:45
|
| Sweet. Thanks! |
 |
|
|
|
|
|