Matching the table

  • Hi All,

    I have two table called TableA and TableB. Here I need to match the TableB records from TableA.

    TableA

    http://www.funoppia.com

    http://www.finkeyz.com

    w.astronecollege.com

    http://learningberg.com

    http://www.mytutorials.co.in

    http://www.firki.co

     

    TableB

    funoppia.com

    http:/finkeyz.com

    ww.astronecollege.com

    https://learningberg.com

    mytutorials.com

    firki.com

    I need to find the matching records from TableB in TableA

    Attachments:
    You must be logged in to view attached files.
  • Well, technically, many of those do not match. w.astronecollege.com and ww.astronecollege.com are different more than just whether or not one has http:// or https:// in front. The others, you could simply use SUBSTRING to strip the leading characters off. Note though, that will result in slow performance in a query. That takes care of the ones that match, except for the inclusion of the URL definition. The issue is, what about the ones that absolutely do not match such as firki.com and http://www.firki.co?

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • The problem I see as Grant Fritchey allued to is that you have not defined what you mean by matching data.  I mean I can eyeball what you have presented a simply say there are no matching records because you did not say what your matching criterion is and as such I would match field with field they would all fail.

    Now however if you are saying what you are trying to match is, as Grant suggested, a substring then you need to clearly define the business logic for that substring as we could make guesses on our side as to what that means but without clearly defined business rules we would be shooting at a target in utter darkness.

    Always know your data in totallity before you decide to work on it, otherwise you will constantly be re-engineering things which usually uses twice to five times as much effort.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply