List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 21 2003 7:55pm
Subject:Re: Hi and why
View as plain text  
At 16:47 -0200 1/21/03, Valdir Stiebe Junior wrote:
>  > I don't know why it returns the first two rows, but (assuming you didn't
>>  really end your query with two question marks) what error are you
>expecting
>>  to occur?
>
>I didn't end my query with the two question marks. :)
>And if i put 0 instead of (2 or any different of zero) after the equal sign
>the sql return nothing. (better than returning garbage)
>I was expecting something like 'Column NAME isn't of type integer'.

That won't happen. MySQL performs extensive type conversion of values,
attempting to execute the query in the most sensible way given what you
provide.

I'm stlll surprised that NAME = 2 returns anything.  When I tried your
example, it returned no rows.  I get two rows with NAME = 0, nothing
with NAME = 2.  Are you sure you're not mixing up your test results?

NAME = 0 is a string-to-number conversion.  MySQL converts the string
to a number and performs a numeric comparison.  Of your three values,
'ppl1' and 'ppl2' will be converted to 0 (which compares the same as 0),
but NULL is still NULL (which does not compare the same as 0).

If you're getting two rows with NAME = 2 and nothing with NAME = 0,
I'm at a loss to explain it.
Thread
Always need to change to root user when I start the serverAlejandro C. Garrammone21 Jan
  • Re: Always need to change to root user when I start the serverDavid T-G21 Jan
  • re: Always need to change to root user when I start the serverEgor Egorov21 Jan
    • Hi and whyValdir Stiebe Junior21 Jan
      • Re: Hi and whyPaul DuBois21 Jan
    • Re: Hi and whyValdir Stiebe Junior21 Jan
      • Re: Hi and whyPaul DuBois21 Jan
      • RE: Hi and whyDean Harding21 Jan
    • Re: Hi and whyValdir Stiebe Junior21 Jan
    • Re: Hi and whyValdir Stiebe Junior21 Jan
      • Re: Hi and whyPaul DuBois21 Jan
    • Re: Hi and whygerald_clark21 Jan
    • Re: Hi and whyGelu Gogancea21 Jan