I have a company table where company_Code is the highest level of the heirarchy, and under each compnay_Code there are numerous divisions. I have a select statement where I have several company codes that should not be included, but I need to make an exception within one of those company codes to still include 2 of the divisions. There are 904 divisions total for this company_code. The current statement is:
select top (1000000) companyid
,companyfullname
,company_code
,division
,reportingname
,division_name
,country
,accountname
from totaldw.dbo.companymap
where company_code not in ('1760','1785','1771','1831','1740')
but I need to modify so that company_Code 1771 is still not included unless the division in ('01188', '01189').