SQL fix for complex getCompanyList