sql - difference between Not In and <> or <> -


is there difference in below 2 codes, getting huge difference in output.

1)

sum(  case  when lientype.id not in (-1, -3)    ((a.floatingspread + dbo.maxfloat(a.floatingspreadfloor, al.liborrate)) * pos.marketvalue)    else 0  end)/nullif(sum(  case  when lientype.id not in (-1,                           -3)    (pos.marketvalue)    else 0  end),0) averagecoupon 

2)

sum(  case  when (      lientype.id<>-1      or      lientype.id<>-3    )       ((a.floatingspread + dbo.maxfloat(a.floatingspreadfloor, al.liborrate)) * pos.marketvalue)    else 0  end)/nullif(sum(  case  when (      lientype.id<>-1      or      lientype.id<>-3    )       (pos.marketvalue)    else 0  end),0) averagecoupon 

the not in case should translate <> -1 , <> -3. having <> -1 or <> -3 translates not in (-1) or not in (-3), outputs different.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -