Connecting Tech Pros Worldwide Help | Site Map

The trouble with Zero...

  #1  
Old May 12th, 2009, 10:13 AM
Member
 
Join Date: Mar 2007
Posts: 94
Hi,

My CF query script isn't bringing up the same result in Access, and I think it's the way zeroes are handled that's the problem.

My Access query has three query fields - two for text and one for a number range when the number is >=0 And <=2.9

Access brings a result of 16. CF brings a result of 42!

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="KWBand1S" dbtype="query">
  2.         select         ClientFK,
  3.                 ResponseLevelFK,
  4.                 PowerRating    
  5.         from         getPumps
  6.         where        ResponseLevelFK like 'Standard'
  7.                 and (PowerRating >=0
  8.                 and PowerRating <=2.9)
  9.         </cfquery>
If I change the query to
Expand|Select|Wrap|Line Numbers
  1. ResponseLevelFK like 'Standard'
  2.                 and (PowerRating >0
  3.                 and PowerRating <=2.9)
(ie change >=0 to >0.
Then it brings up 16. But I'm not sure then that is doing the same thing as my Access query...

Can anyone help?
Cheers
Neil
  #2  
Old May 12th, 2009, 03:24 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: The trouble with Zero...


Are the rest set as NULL? Perhaps Coldfusion is treating them as 0.
  #3  
Old May 12th, 2009, 03:26 PM
Member
 
Join Date: Mar 2007
Posts: 94

re: The trouble with Zero...


Yes, they are, tho CF seems to get the same results with >0 rather than >=0...

I'll add an IS NOT NULL appendage to my scripting and test it.

Thanks!
  #4  
Old May 13th, 2009, 11:12 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: The trouble with Zero...


Did that solve the problem?
  #5  
Old May 13th, 2009, 11:24 AM
Member
 
Join Date: Mar 2007
Posts: 94

re: The trouble with Zero...


I haven't had time to test it yet, but I'll post what happens when I do.

(I'm in a 'jack of all trades' job that requires me to use CF intensively for about 2 weeks, then not touch it for 6 months or so, hence I forget quite a bit about it...)
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with zero-length string error using OpenArgs angi35 answers 3 August 8th, 2008 10:43 PM
trouble with DBA bobh answers 1 November 28th, 2007 11:45 PM
Trouble with reference counting BravesCharm answers 3 November 16th, 2005 04:44 PM
Trouble with scanf Eric A. Johnson answers 8 November 14th, 2005 05:38 PM