Help with SQL query

Posted on 2008-11-03
Last Modified: 2010-03-20
I have a query which contains this line:

ON t1.SSN = right(t2.SSN, len(t2.SSN) - 1)

t1.SSN is now being changed to SSNLast4, which will contain the last 4 of the SSN instead of the entire SSN. So, how do I change the code on the right of the equal sign accordingly?

I'm trying to say "ON t1.SSNLast4 = Last4 of t2.SSN"

Question by:isaacr25
    LVL 73

    Accepted Solution

    LVL 60

    Expert Comment

    where t.ssnlast4 = left(t2.ssn, 4)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

    794 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

    17 Experts available now in Live!

    Get 1:1 Help Now