MySQL return rows ONLY if ALL the rows in another table have a specified value I have two tables
Table1 :
efd_details( id ) 

Table2 :
efd_detail_status( detail_id  , status )

Now the data as following :
select * from efd_details;

Output :
ID
1
2
3
4
5

select * from efd_detail_status ;

Output :
DETAIL_ID | STATUS
1         |   's'
2         |   's'
3         |   's'
4         |   null
5         |   'f'

What I need to do is get all the details (efd_details) ONLY if ALL the statuses in efd_detail_status = 's'. In the example above, I would retrieve ZERO records since two of the status are != 's'. If ALL the status = 's' then return ALL rows from cms_efd.
I have tried variations of EXISTS and the following:
select e.*
  from cms.cms_efd e
where exists(select 1 
               from cms.cms_efd_status s 
              where s.detail_record_id = e.detail_record_id 
                and IFNULL(s.contrib_calc_status,'f') != 's'
             having count(e.detail_record_id)=count(s.detail_record_id))
    and e.earnings_file_id = 400676;



Appreciate the help.
-Branden
Turn it around and do something like
WHERE NOT EXISTS ( SELECT 1 FROM cms.cms_efd_status
                   WHERE ... != ... )
  AND e.earnings_file_id = 400676