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 |
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-03-17 : 19:37:40
|
| Hi - I am having a problem that I think may be related to the data, am not sure if there is anything I can do about it. Here is what I have:select ReportingMonth, SponsorId, BenefitPlan, sum(NonHVMAMemberMonths + HVMAMemberMonths) as TotMMSfrom actuarial.sponsormemberdetail where reportingmonth between '3/1/2008' and '2/1/2011' and sponsorid not in ('100002', '100003') group by sponsorid, reportingmonth, benefitplanI am trying to get TotMMS by benefit plan grouped by month and sponsor id. The way I have it above does not work because there are NULL values in the benefit plan of my data. Is there any way to solve this - via a sub-select or something like that??Thanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-17 : 21:59:25
|
"The way I have it above does not work because there are NULL values in the benefit plan"can you elaborate what do you mean by "does not work" ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
subhbwn
Starting Member
6 Posts |
Posted - 2011-03-18 : 00:29:09
|
| You can try with : select ReportingMonth, SponsorId, BenefitPlan, sum(NonHVMAMemberMonths + HVMAMemberMonths) as TotMMSfrom actuarial.sponsormemberdetailwhere reportingmonth between '3/1/2008' and '2/1/2011'and sponsorid not in ('100002', '100003')group by reportingmonth, sponsorid, benefitplanTo get help you can refer http://www.w3resource.com/sql/aggregate-functions/sum-multiple-columns.php, http://www.w3resource.com/sql/between-operator/sql-between-operator.php and lots of examples. |
 |
|
|
|
|
|
|
|