select distinct substring_index(email, "@", -1) as Domain
from users

Hope this helps
Simon

-----Original Message-----
From: Daren Cotter [mailto:[EMAIL PROTECTED]]
Sent: 05 April 2001 04:02
To: [EMAIL PROTECTED]
Subject: Query Help


I have a database which has about 100,000 emails. I need to write some
function to retrieve the domains of all these emails, and the count of each,
to help catch cheaters. I began by just selecting all the emails with my
query, and trying to use PHP to do all the work, but I think this could all
be done w/ mysql. I'm thinking there must be some way, using the string
functions, to write a query that just retrieves the domain of each email,
and then I could use DISINCT and COUNT for the rest. By domain, I mean this:

[EMAIL PROTECTED] becomes yahoo.com, [EMAIL PROTECTED] becomes
subdomain.domain.com.

If anyone could help me out with this query, I'd really appreciate it.

TIA,



Daren Cotter


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to