I have the following data in my table A.
team | name | status | start_date | end_date
----------------------------------------------
A Ann Active 2016-01-01 2016-06-01
A Linh Active 2016-01-01 2016-06-01
A John Hold 2016-01-01 2016-06-01
A Soph Closed 2016-01-01 2016-06-01
I can do select from table A where status='Active' to get the active members.
Now, the requirement has changed to that if there at least one "Active" status member, I should look for both "Active" and "Hold" status members in the query.
If there is not "Active" status member, then I should NOT look for "Hold" status members.
How should I write in one SQL?
Activestatus..." (in the sample it's true - we have the very1st record withActivestatus)Activestatus you should provide records of this person with bothActiveandHoldstatuses? (Johnshould be excluded, he doesn't have any records withActivestatus)f there is not "Active" status member, then I should NOT include other status membersleads me to different interpretation. Please author post expected result and add some sample data?..