When the obvious answer is obviously wronghttp://sqlblog.com/blogs/john_paul_cook/archive/2011/03/09/when-the-obvious-answer-is-obviously-wrong.aspxThis post is about how simple math in T-SQL can produce undesirable results, but first we begin with a math quiz. Answer the following as quickly as possible: You just read pages 100-300 of a book. How many pages did you read? QUICKLY NOW! For those ofenCommunityServer 2.1 SP2 (Build: 61129.1)re: When the obvious answer is obviously wronghttp://sqlblog.com/blogs/john_paul_cook/archive/2011/03/09/when-the-obvious-answer-is-obviously-wrong.aspx#34056Thu, 10 Mar 2011 21:52:18 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:34056MarcShapiro<p>I think the last computation is simpler as</p>
<p>( (n.amount - nMinus1.amount) / ABS(nMinus1.amount) ) * 100</p>
re: When the obvious answer is obviously wronghttp://sqlblog.com/blogs/john_paul_cook/archive/2011/03/09/when-the-obvious-answer-is-obviously-wrong.aspx#34170Wed, 16 Mar 2011 00:21:33 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:34170Leonid<p>Is there a chance that nMinus1.amount=0?</p>