All Forums Database
realrx7 17 posts Joined 06/12
25 Jun 2012
SQL to drop last four digits from a 9 digit zip code

Hello everyone,

I need some help figuring out how to drop the last four digits of a 9 digit zip code. If I have a list of subscribers with a couple hundred thousand that have zip codes withe the following format...."27751-9099". Is there anyway that I can remove the last four digits so that we can compare zip codes based on a 5 digit basis?

dnoeth 4628 posts Joined 11/04
25 Jun 2012

It's not dropping the last four digits, it's extracting the first five?

Good old "substring(zip_code from 1 for 5)"?

Dieter

Dieter

realrx7 17 posts Joined 06/12
25 Jun 2012

I never thought of it that way. Brilliant!!

You must sign in to leave a comment.