Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

OR condition - help!

$
0
0

Script for the sample data as below

create table #Country
(
InvestorID int,
PermResTax1 varchar(50),
PermResTax2 varchar(50),
Citizenship1 varchar(50),
Citizenship2 varchar(50),
CountryBirth varchar(50),
AddressCountry varchar(50)
)
INSERT INTO #Country values (111, 'United Kingdom','Spain','Gibraltar','France','France','GBR')
INSERT INTO #Country values (222, 'Isle of Man','None','France','Spain','France','Gibraltar')
INSERT INTO #Country values (333, 'United Kingdom','None','France','Spain','France','Gibraltar')
INSERT INTO #Country values (444, 'United Kingdom','None','United Kingdom','Spain','France','Gibraltar')
INSERT INTO #Country values (555, 'United Kingdom','None','United Kingdom','Spain','France','GBR')
INSERT INTO #Country values (666, 'Spain','None','Gibraltar','Spain','France','Isle of Man')
INSERT INTO #Country values (777, 'Spain','United States','Gibraltar','Spain','France','Isle of Man')
select * from #Country

Requirement is to only return data if neither of the 6 columns is GBR/United Kingdom/None but only when all 6 cols are populated with NON GBR countries. Eg 777

Please help !


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>