Hello All,
I need to validate State and ZipCode. I will have to extract all the data where is there is data mismatch between state and zipcode in my table elgadr.
The fields in elgadr are
for state: erstat
for zipcode: erzpcd
and data shows like
erstat erzpcd
CA 95682
To handle this. I created another table called state with valid zipcode ranges for each state
state_Code zipcd1 zipcd2 zipcd3
CA 900 966 0
My Query is :
SELECT
elgadr.erstat,
elgadr.erzpcd
FROM elgadr, state
WHERE elgadr.erstat = state.state_code And
((elgadr.erzpcd) NOT BETWEEN left([zipcd1, 3]) And
left([zipcd2, 3]) OR
elgadr.erzpcd <> left([zipcd3, 3]);
Someone please help
I need to validate State and ZipCode. I will have to extract all the data where is there is data mismatch between state and zipcode in my table elgadr.
The fields in elgadr are
for state: erstat
for zipcode: erzpcd
and data shows like
erstat erzpcd
CA 95682
To handle this. I created another table called state with valid zipcode ranges for each state
state_Code zipcd1 zipcd2 zipcd3
CA 900 966 0
My Query is :
SELECT
elgadr.erstat,
elgadr.erzpcd
FROM elgadr, state
WHERE elgadr.erstat = state.state_code And
((elgadr.erzpcd) NOT BETWEEN left([zipcd1, 3]) And
left([zipcd2, 3]) OR
elgadr.erzpcd <> left([zipcd3, 3]);
Someone please help