How to make such a query criterion?

ariansman

Registered User.
Local time
Yesterday, 23:17
Joined
Apr 3, 2012
Messages
157
There is an employee table where characteristics of employees are recorded. Just as an example, we want a query to show female employees, employees aged 30, or both. In other words, we need the query to show records based on two criterion, however if one criteria is empty that criterion should be ignored. If this works, in case we select the age to be 30, and we leave the gender to be blank, the query will show data about employees who are aged 30, and are female, male, or no gender mentioned. On the other hand, if we select gender to be female and leave the age criterion blank, the query will show all female employee regardless of their age.

how can we make such a criterion?
 
The approach is

Where (field1=criterion1 or criterion1 is null) and (field2 = crierion2 or criterion2 is null)

Brian
 

Users who are viewing this thread

Back
Top Bottom