I have a table that include 3 fields (among others) that for each of them that is equal to 1 I need the query to return a record.
So, if all 3 fields are equal to 1 the query should give 3 records.
If two fields (any of the three) are equal to 1 the query should return 2 records and so on.
How would a query like that look?
This should do what you need:
The logic is that we select the rows we need for each criteria one by one, and then create an union of them. It is true however, that this does not scale nice… Then again, I have never ever faced this requirement “out in the wild”…