Results 1 to 2 of 2

Thread: getting the distinct values to the RIGHT of the “@”

  1. #1
    Join Date
    Oct 2003
    Posts
    2

    getting the distinct values to the RIGHT of the “@”

    have a table of 750,000 records



    I’d like to get a distinct listing of domain for this table. However, I do not isolate the domain name of an email address as its own field



    I need an SQL statement that will SELECT Distinct off of my email field, getting the distinct values to the RIGHT of the “@”

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Try this

    select distinct substring(emailcolumn,charindex('@',emailcolumn),d ata_length(emailcolumn)-charindex('@',emailcolumn)-1)
    from yourtable

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •