ssms - How to create a SQL Server query to do validation against preexisting look up (base) table? -
i have customer customer records in 1 of fields country.
say below records , column customer number, column customer name , column c country
cnumber cname ccountry ----------------------------- 0001 customera usa 0002 customerb japan 0003 customerc france 0004 customerd hoss
in sql server database, there tabled name country has countries there listed there. query compare customers have valid country name in column c. can see customer 0004 has country hoss not country. need query tell me invalid country 0004 customer.
thanks help.
if want list records invalid country
select * customer ccountry not in (select ccountry country)
Comments
Post a Comment