I am trying to write a where clause that will find people who have meet at least two of three criteria.
This is an example
SELECT *
FROM Personal
WHERE
[State] = 'Tx' or [City] = 'Austin' or [Gender] = 'Male'
So It should return anyone who Lives in Texas and Austin or Lives in Texas and is Male and so on, but not someone who just lives in Texas, they have to meet at least two of the criteria
My real query can have more criteria and also include a greater than two or exactly two and so on.
Thanks in advance
You might add matches in a series of case … then 1 else 0 end statements and compare final result to number of required matches:
Alternatively, you might break it into a list of union all: