MattC
MattC

Reputation: 135

Matching email address from one table to spreadsheet with multiples in 1 column

We have a contact database to indicate Contact Name, E-mail address (unique), etc..

We have receive a contact list from a vendor that we're trying to match up so that we can send the appropriate contracts for.

However the contact list we received from the vendor has the email address column stored with multiple email addresses. ([email protected],[email protected],etc.)

How can I query from my internal contact table to their sheet (I will import to sql) so that I can match my unique email address to their email column when it might have more than 1 email address in it?

Upvotes: 0

Views: 255

Answers (1)

Bernd Böllert
Bernd Böllert

Reputation: 106

In that case, your email addresses are substrings of the given.

So you should use the like keyword on your email addresses and an inner join on theirs.

In Oracle Syntax:

select my.* 
  from contacts as my, contact_list as theirs
 where theirs.emailadresses like '%' || my.email || '%'

In ANSI, I think it would be similar to:

select my.* 
  from contacts as my join contact_list as theirs
 where theirs.emailadresses like '%' + my.email + '%' 

Upvotes: 1

Related Questions