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 |
|
shajimanjeri
Posting Yak Master
179 Posts |
Posted - 2010-06-09 : 13:30:00
|
| I have a table with some data. i wrote one query like :select sum(DISTINCT(round(Month_Bill,0))) as gsmsum, sum(DISTINCT(round(January,0))) as hardwaresum, sum(DISTINCT(ROUND(TotalMonthlyFeeAfterDisc + TotalOnetimeFeeAftrDisc + (SlaFee - DiscountAmtSla) ,0))) as datasumfrom V_ALLREPORTS WHERE PF = 'PF103050' OR ( Month(IssuedOn) = '01' and CirciutStatus = 'Applied'and MONTH(CercuitActivationDate) = '01')this give me the wrong datasum. Actually for month 01 there is no datasum valueI want if any of the condition is correct then show dataany body can help meregardsShaji |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
shajimanjeri
Posting Yak Master
179 Posts |
Posted - 2010-06-09 : 14:04:11
|
| Here after executing this query, it gives me gsmsum = 1083787hardwaresum = NULLdatasum = 405331here datasum should be NULL. There is no data for datasum. But while execute this query I am getting datasum = 405331Here Month(IssuedOn) = '01' and CirciutStatus = 'Applied' conditions are for sum(DISTINCT(round(Month_Bill,0))) as gsmsum criteriaMONTH(CercuitActivationDate) = '01' condition is for sum(DISTINCT(ROUND(TotalMonthlyFeeAfterDisc + TotalOnetimeFeeAftrDisc + (SlaFee - DiscountAmtSla) ,0))) as datasumI want to check any of these where conditions. regards |
 |
|
|
shajimanjeri
Posting Yak Master
179 Posts |
Posted - 2010-06-09 : 14:17:08
|
| Still not clear? |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-06-09 : 14:47:28
|
| Have a look at thisHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|
|
|