Name Matching

Posted on 2007-10-09
Last Modified: 2010-03-20
I'm running a Select Query and I'm trying to link two tables, but the problem is the data in my INNER JOIN...  the only data I have to use is FirstName and/or LastName.  Are there any good expressions that can stack the data to lessen the results, without compromising the results?
Question by:z018196
    LVL 11

    Expert Comment

    Are you already doing JOIN ON t1.FirstName = t2.FirstName AND t1.LastName = t2.LastName?

    Is there another field that you could use GROUP BY on?

    What do you want? What fields do you have in each table?

    Author Comment

    Yeah, those are the fields I'm already joinging... but I'm getting a lot of duplicates.  Unfortunately, one table is ONLY FirstName and LastName.  Suggestions?
    LVL 11

    Accepted Solution

    Why are you joining if 1 table is just first and last names?

    I'm thinking you want:

        SELECT * FROM table1 AS t1
            ( SELECT * FROM table2 AS t2
            WHERE t1.FirstName = t2.FirstName
            AND t1.LastName = t2.LastName);

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now