In my continuing exploration of SQL, to fix the database in the way I want it,
I figured I needed a quick and dirty fix for the URLs that ended in / and those
that didn't. The reason is duplicate checking -- I went from no dupes to 33
dupes on a 300 record database after using it.
WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'
Will find the links and display them that end in the most common domain endings.
You can add more to it just by following the example above. It won't catch the
url's that end with a directory name, but maybe I'll work on that.
To actually update the links, use:
SET URL = CONCAT(URL,'/')
WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'
You might want to try it on a test database first, using the INSERT query
I posted awhile back.
I figured I needed a quick and dirty fix for the URLs that ended in / and those
that didn't. The reason is duplicate checking -- I went from no dupes to 33
dupes on a 300 record database after using it.
Code:
SELECT URL FROM Links WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'
Will find the links and display them that end in the most common domain endings.
You can add more to it just by following the example above. It won't catch the
url's that end with a directory name, but maybe I'll work on that.
To actually update the links, use:
Code:
UPDATE Links SET URL = CONCAT(URL,'/')
WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'
You might want to try it on a test database first, using the INSERT query
I posted awhile back.