Multiple zips in extractions

could anyone provide how to edit codes to include multiple zip codes in a list manager (that also can be used in extractions?) And should I use = or Like?

 

Parents
  • In List Manager, if you select a 5-digit postal code as your sole criterion (Postal Code = 33133), then click on the Manual Edit button, you should see something like this:

     

    Select Distinct a.customer_no

     From V_CUSTOMER_WITH_PRIMARY_GROUP a (Nolock)

    JOIN vs_address e (Nolock) ON e.customer_no = a.customer_no

    Where  IsNull(a.inactive, 1) = 1

     AND e.postal_code = '33133'

     

    That takes care of all addresses that have the exact postal code “33133” but misses the zip plus 4’s. So edit the last line of the code to look for the first 5 digits only, and use “in” followed by parentheses including all the 5-digit postal codes that you are interested in. Note that the postal codes have single quotations around them, because they are, for the purposes of the code, text strings, not numbers:

     

    Select Distinct a.customer_no

     From V_CUSTOMER_WITH_PRIMARY_GROUP a (Nolock)

    JOIN vs_address e (Nolock) ON e.customer_no = a.customer_no

    Where  IsNull(a.inactive, 1) = 1

     AND substring(e.postal_code,1,5) in ('33133','33134','33143','33146','33156','33158')

     

    I’m sure there’s an easier way to do this, but this works.

     

    Lucie

     

    ______________________________
    Lucie Spieler
    IT Development and Training Manager

    Florida Grand Opera

Reply
  • In List Manager, if you select a 5-digit postal code as your sole criterion (Postal Code = 33133), then click on the Manual Edit button, you should see something like this:

     

    Select Distinct a.customer_no

     From V_CUSTOMER_WITH_PRIMARY_GROUP a (Nolock)

    JOIN vs_address e (Nolock) ON e.customer_no = a.customer_no

    Where  IsNull(a.inactive, 1) = 1

     AND e.postal_code = '33133'

     

    That takes care of all addresses that have the exact postal code “33133” but misses the zip plus 4’s. So edit the last line of the code to look for the first 5 digits only, and use “in” followed by parentheses including all the 5-digit postal codes that you are interested in. Note that the postal codes have single quotations around them, because they are, for the purposes of the code, text strings, not numbers:

     

    Select Distinct a.customer_no

     From V_CUSTOMER_WITH_PRIMARY_GROUP a (Nolock)

    JOIN vs_address e (Nolock) ON e.customer_no = a.customer_no

    Where  IsNull(a.inactive, 1) = 1

     AND substring(e.postal_code,1,5) in ('33133','33134','33143','33146','33156','33158')

     

    I’m sure there’s an easier way to do this, but this works.

     

    Lucie

     

    ______________________________
    Lucie Spieler
    IT Development and Training Manager

    Florida Grand Opera

Children
No Data