Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Splitting similar data into separate columns

$
0
0
If you see below there are 2 customer names on 1 loan, most of them share the same lastname and address, I want to separate it with fields,LoanID, customer 1 Firstname, Customer 1 Lastname, Customer 2 FirstName, Customer 2 Lastname, Adddress,zipLoan ID First Name Lastname Address address 2 City State Zip1236048 Joey Yesen xxxx abc GROVE RD NULL CLEVELAND TX 773271236048 Dickey Yesen xxxx abc GROVE RD NULL CLEVELAND TX 773271235983 Randy Seany xxxx abc Haleyville St NULL Aurora CO 800181235983 Barry Seany xxxx abc Haleyville St NULL Aurora CO 80018The query I am using select L.Loanid,B.FirstMiddleName ,B.LastName ,MA.AddressLine1 ,MA.AddressLine2,MA.City,MA.State,MA.Zipfrom Loan AS L LEFT JOIN Status As S on S.LoanID = L.LoanIDLEFT JOIN Borrower B on B.LoanID = L.LoanIDLEFT JOIN MailingAddress MA on MA.LoanID = L.LoanIDwhere S.PrimStat = '1' and B.Deceased = '0'

Viewing all articles
Browse latest Browse all 3145

Trending Articles