Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl/MySQL Problem

by Cody Pendant (Prior)
on Feb 24, 2002 at 11:58 UTC ( [id://147168]=note: print w/replies, xml ) Need Help??


in reply to Perl/MySQL Problem

I don't like the look of this bit:

active != "0"

isn't it supposed to be "<>" for not equals in SQL?

also, use brackets when you've got complicated ANDs and ORs, it'll help you see it better, like:

SELECT * FROM users WHERE (state = "FL" OR state = "NY") AND (active <> 0)
and are you supposed to be quoting number values?

I've now reached the end of my SQL knowledge, but is there a difference between active=0 and active="0"? If it's the contents of a number-type field?
--

Replies are listed 'Best First'.
Re: Re: Perl/MySQL Problem
by biograd (Friar) on Feb 24, 2002 at 20:40 UTC
    In MySQL, you can use either <> or != interchangeably in the where statement. Ref=pg 253 of MySQL & msql (O'Reilly).

    I have not found that it makes a difference putting quotes around a number or not in my experience, but who's to say I haven't just been lucky?

    -jenn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://147168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2024-04-25 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found