How about this?

SELECT
  SUBSTRING_INDEX(SUBSTRING(url, LOCATE("//", url) + 2), '/', 1) AS domain
FROM referals

Michael

On Wed, 1 Oct 2003 14:54:24 +0100, Graham Nichols <[EMAIL PROTECTED]> wrote:

Hi,

I have a table containing page referral URLs gleaned from users browsing my website. Is there a way for me to use SELECT based on a portion record's contents?

eg

table contents:

http://www.yahoo.com/adirectory/apage.htm
http://google.net/adirectory/anotherpage.php

I wish to return only the portion between the // and /. Sort of a //*/ thing so I can use COUNT with this to allow me to build a table in PHP of the most popular root domains which go to my site.

I hope this all makes sense ;-)

kind regards, Graham Nichols.



-- Michael Johnson < [EMAIL PROTECTED] > Internet Application Programmer, Pitsco, Inc. 620-231-2424x516

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to