I'm building a query on this table
my_table
field1 | field2
1 | y
2 | y
3 | y
4 | n
1 | n
2 | n
3 | y
4 | y
I am looking for a rule (maybe IF) to select all the records excluding the ones where field1=1 AND field2=y
this record will not be selected:
field1 | field2
1 | y
while this is ok
field1 | field2
1 | N
EDIT:
I add this details: the query is longer:
SELECT * FROM my_table WHERE time>'time1' AND time<'time2' AND admin_area='0'
in this query i have to append a filter: if field2=Y exclude records where field1=1