Reputation: 3125
I need to join 2 tables together on the 'URL' column, however because of some crazy problems on our back-end, the URLs get logged inconsistently (slash/no-slash) in the two tables: http://google.com/
vs. http://google.com
.
After I run my query to join, I get:
URL DATE
http://facebook.com 20130914
http://google.com/ NULL
http://youtube.com/ NULL
I'm a beginner with SQL, but does SQL have something like after you run a query, IF item in column is empty, then run query again?
I found How to ignore trailing slash while joining two string columns in SQL that I can then modify the 2nd query to remove trailing slash if exist.
Upvotes: 0
Views: 74
Reputation: 11841
Unfortunately, your best best course of action is to cleanup the data and normalize it on insert. The problem here is that you are performing a join with this data. Any work around will be very inefficient from a performance perspective.
Upvotes: 1