SELECT Field3, Field2 ; FROM MyTable ; WHERE Field2 IN ("X","Y","Z") ; AND (Field1 = "2" OR EMPTY(Field1)) ; GROUP BY 2 ; INTO CURSOR MyResult