List:General Discussion« Previous MessageNext Message »
From:Michael Stassen Date:November 19 2004 3:49pm
Subject:Re: detect rows that has zero values
View as plain text  
Good point.

Michael

SGreen@stripped wrote:

> Michael, 
> 
> As was just discussed in this list, non-numeric strings values  will also 
> evaluate to FALSE but if that string starts with a number, it could be 
> TRUE or FALSE (depending on the actual value of the numeric portion of the 
> string). 
> 
> He never explicitly said if those were numerical fields or not (though it 
> is reasonable to assume they are because he is comparing them to 0 and not 
> '0'). So your solution is more likely than not a shorthand way of 
> representing a valid solution to this particular query, I must caution the 
> newer readers of this list against using this technique with non-numeric 
> fields as your answers may not agree with your expectations.
> 
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
> 
> Michael Stassen <Michael.Stassen@stripped> wrote on 11/19/2004 10:02:19 
> AM:
> 
> 
>>denys wrote:
>>
>> > SELECT  country
>> > FROM Rates
>> > WHERE fieldvalue1 <> 0 AND fieldvalue2 <> 0 AND fieldvalue3
> <> 0
>> > ORDER BY country
>> > is it what you want ?
>> >
>>
>>Gleb Paharenko wrote:
>>
>>
>>>Hello
>>>
>>>You may use query like this:
>>> select country from rates where (fieldvalue1 !=0) and (fieldvalue2 
> 
> !=0) 
> 
>>> and (fieldvalue3 !=0) order by country;
>>>
>>>See:
>>>  http://dev.mysql.com/doc/mysql/en/Comparison_Operators.html
>>
>>And since 0 is false and every other number is true, this could be 
>>simplified to
>>
>>   SELECT country
>>   FROM Rates
>>   WHERE fieldvalue1 AND fieldvalue2 AND fieldvalue3
>>   ORDER BY country;
>>
>>Michael
>>
>>
>>-- 
>>MySQL General Mailing List
>>For list archives: http://lists.mysql.com/mysql
>>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>>
> 
> 
Thread
detect rows that has zero valuesLouie Miranda19 Nov
  • Re: detect rows that has zero valuesdenys19 Nov
  • Re: detect rows that has zero valuesGleb Paharenko19 Nov
    • Re: detect rows that has zero valuesMichael Stassen19 Nov
      • Re: detect rows that has zero valuesSGreen19 Nov
        • Re: detect rows that has zero valuesMichael Stassen19 Nov
      • Re: detect rows that has zero valuesBulant Denys19 Nov
        • Re: detect rows that has zero valuesMichael Stassen19 Nov
        • Re: detect rows that has zero valuesMartijn Tonies19 Nov