* John Mistler
> I have a table in which the first column is either 1 or 0. The second
> column is a number between 0 and 59. I need to perform a query
> that returns
> entries where:
>
> 1. IF the first column is 1, the second column is NOT 0
> 2. IF the first column is 0, the second column is anything.
>
> It seems simple, but I'm not getting it right. Any ideas?
Try this:
SELECT * FROM tab1
WHERE
(col1 = 1 AND col2 <> 0) OR
(col1 = 0)
When combining AND and OR, proper use of parantheses is important.
--
Roger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]