We have a 336 five digit zip codes that we want to target and pull through using sql in Marketing Cloud. We tried a left join where we're matching up the zip code from the table of 336 to our customer orders. The problem we're facing is we have more than five digit zip codes in our orders table.
How do I write my query to only match up the first five digits (or anything before the hyphen) from our customer orders table to the table with the targeted zip codes?
Below is what we have tried so far:
left join ZIPCODETABLE ta on ta.Zip like '%co.Zip%'
left join ZIPCODETABLE ta on ta.Zip = co.Zip where ta.Zip LIKE '_%-'
set zipcode = left(zipcode, 5) where right(ltrim(rtrim(zipcode)),1) = '-'