You should be able to handle it with a simple
NOT EXISTS check:
UPDATE deals d SET d.status='approved' WHERE NOT EXISTS (SELECT * FROM deal_details WHERE deal_details.dealid = d.id AND status <> 'completed');
This assumes there are always rows in the
deal_details table, if there are none it will mark the deal approved.