I want to query our database to find how many different domains customers use for their email address.
Is this the correct syntax?
SELECT PR.EmailAddress FROM PatronRegistration PR with (nolock) WHERE PR.EmailAddress LIKE '@%'
Because 0 rows are returned.
"@" is used to preceed variables but I thought this would work to within the single quotes
asked Mar 15 '12 at 03:56 PM in Default
If you're matching full email addresses, you'll need the wildcard before and after the @ sign.
--edit-- - If you're looking for more quantitative information, then this query might be of use:
This will return the domain names and the count of the number of times they are used.
Yes Tim, that's exactly what I am after. Thanks Thomas for the script. Now I have new tool "substring" with which to work.
Jon,Yes Tim I am looking for the number of instances of every domain that is in our database. Thanks Thomas, that's exactly what I needed.
answered Mar 26 '12 at 08:02 PM
That is only looking for an email address that starts with @. Are you just wanting the domains to be returned such as .com, .org, .edu?
answered Mar 15 '12 at 04:01 PM