Originally Posted by Old Pedant
How it works:
First, we concat a '/' to the end of the URL, just in case there is none there already.
Then we replace 'http://' and 'https://' and 'www.' with nothing.
That gets us down to something like codingforums.com/gobbledygook/
So then we use LOCATE to find the first '/' in that (which MIGHT be the one we added at the first step).
And then we use SUBSTR to get all the characters up to but not including that first '/'.
It does make sense, however I double checked my table and it does contain subdomains as well. Perhaps if it were possible to also ignore the first part of the subdomain as we did with the www.,
then as long as I could display the entire field at the end, I think I would get good results. I don't see any duplicate domains that have different sudomains....it seems if I have download.microsoft.com, that is all I have, I don't have ie.microsoft.com as far as I can tell.