I have a sample database:
Var1 Var2 Status
=========================
A1 SG1 Completed
A2 SG2 Completed
A2 SG1 Progress
Statuses can be as many as 10 different statuses.
I want to pull all the records only when all the rows’ Status is ‘Completed’. Meaning in this case no rows will be pulled. Only if all rows = ‘Completed’ then only it will pull the entire database.
How can I achieve this in lowest time?
See SQLFiddle for demo