I am in the process of designing a search mechanism to find the closest matching ZIP code from a database. I've searched this site but have found nothing relating to ZIP codes.
The only way I can figure to date to accomplish this is:
First search for a exact match of all five numbers
If nothing is returned, search for an exact match of the first 4 numbers
Finally, if nothing is returned, try for an exact match of the first 3 numbers
This may be too elementary, but just wondering if there is a more elegant solution.