I'm trying to do a select query which I select from a table where field1 and field2 are both greater than 0.
NB field1 & field2 are both INT / NOT NULL.
i've tried doing something along the lines of:
SELECT * FROM tblname WHERE field1 > "0" AND field2 > "0"
SELECT * FROM tblname WHERE field1 <> "0" AND field2 <> "0"
SELECT * FROM tblname WHERE field1 != "0" AND field2 != "0"
SELECT * FROM tblname WHERE field1 = "0"
For a neater code, you can use
LEAST() which takes the smaller argument placed inside the parantheses .
I believe your problem is that you are comparing ranges on strings instead of numbers( you mentioned those are numeric fields) :
SELECT * FROM YourTable WHERE LEAST(field1,field2) > 0
If that doesn't solve your problem - edit your question and define "doesn't work" , nothing is being selected? Throws an error? ..