We can use the AND, OR, NOT logical operators in the Where clause in Query. The purpose of Where clause in Query is to return only rows that match a specified condition.
To NOT select a particular condition, you can use
!=. This would look something like this:
=QUERY(ICON,"Select B,C,A,AF,AG,AH,Z WHERE AF!='NO'")