Message
From
10/02/2017 07:48:21
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Sql comparison
Miscellaneous
Thread ID:
01647831
Message ID:
01647831
Views:
61
HI

I am trying to join two tables in a query based on the domain name in the email

so I have
select * from account a
JOIN contact c
ON
right(c.[EMailAddress1], charindex('@', reverse(c.[EMailAddress1]))-1)  = right(a.[EMailAddress1], charindex('@', reverse(a.[EMailAddress1]))-1)
which gives me the domain name in both emails.

but when I run the query I get a failure when an email address has no @ sign ( few are empty)

any idea whats the best way to deal with that in the query join.

Thanks

Nick Mason
Next
Reply
Map
View