Sorry, I seemed to kick off a nerd fight.  :)

Anyhow, one last question.  If the case statements are evaluating something 
that is not a whole number (or better yet not exactly matching on both sides of 
the equation) .  Why is it that when displaying the results of the math sqlite 
does not produce something like 25.00000000000003 or 22.99999999999?  Shouldn't 
the result have all significant digits showing?  I guess that is why these 
results seem misleading.

Richard

From: Rousselot, Richard A
Sent: Thursday, October 22, 2015 2:45 PM
To: 'sqlite-users at mailinglists.sqlite.org'
Cc: Rousselot, Richard A
Subject: Simple Math Question

Doing the following math, why is it that the results are not all returning 
"yes"?

SELECT
                (9.2+7.9+0+4.0+2.6+1.3),
                case when (9.2+7.9+0+4.0+2.6+1.3)=25.0 then "yes" else "no" end,
                (9.2+7.8+0+3.0+1.3+1.7),
                case when (9.2+7.8+0+3.0+1.3+1.7)=23.0 then "yes" else "no" end,
                (9.2+7.9+0+1.0+1.3+1.6),
                case when (9.2+7.9+0+1.0+1.3+1.6)=21.0 then "yes" else "no" end
FROM
                sometable;

Result
25.0 no 23.0 yes 21.0 no

I'm sure this has an obvious answer but it isn't jumping out at me.

Richard

This communication is the property of CenturyLink and may contain confidential 
or privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful. If you have received this communication in 
error, please immediately notify the sender by reply e-mail and destroy all 
copies of the communication and any attachments.

Reply via email to