I have the following SQL statement. What I am trying to do is find the longest length address that has a zip+4. I know there may be many address that have the same length. My problem is I am getting addresses that do not have a zip+4. Any help would be greatly appreciated:
SELECT TOP 1 ADDRESS FROM waynedb ;
ORDER BY SQNCNMBR WHERE LEN(ALLTRIM(ADDRESS)) = (SELECT MIN(LEN(ALLTRIM(ADDRESS))) FROM waynedb ;
WHERE LEN(ALLTRIM(ADDRESS)) > 0 AND LEN(ALLTRIM(ZIP4)) > 9)
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts. The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.