Consider a table with columns
Here are some facts about the data in this table
A user can select one or both the types to apply a filter. For example, a user might select type 'A' and filter based on is_active true. Or they might select type 'A' with is_active true AND type 'B' with is_active false.
Our task is to count the number of records which satisfies the is_active condition for selected types. Here are some scenarios better explanation
If user restricts is_active for type 'B', IDs without type 'B' should not be included.
If user restricts is_active for type 'A', IDs without type 'B' should be included.
Can this be achieved without using stored procedures? Any help will be greatly appreciated.