Avatar of Soumi Chakraborty
Soumi Chakraborty
 asked on

Function

/ *9.      Write a SQL query to retrieve loan number, customer first name, customer last name,
 property address, and bankruptcy attorney name.  I want all the records that have the
 same attorney name to be together, then the customer last name in order from Z-A
 (ex.Customer last name of Wyatt comes before customer last name of Anderson)*/

 Select  LoanNumber,CustomerFname,CustomerLname,Propertyaddress,BankruptcyAttorneyName
 From Loan
 Group BY BankruptcyAttorneyName,LoanNumber,CustomerFname,CustomerLname,Propertyaddress
Order by
LTrim(Reverse(Left(Reverse(CustomerLname), CharIndex(' ', Reverse(CustomerLname))))) Desc,
CustomerLname Desc -- Fall-over for when there isn't a last name

Is it right comment?
Microsoft SQL Server

Avatar of undefined
Last Comment
Soumi Chakraborty

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dsacker

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Deepak Chauhan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Soumi Chakraborty

ASKER
I've requested that this question be deleted for the following reason:

simple
dsacker

Question asked, question answered. Recommend splitting the points between me and Deepak (250 each) with a grade of A (each).
Soumi Chakraborty

ASKER
Thanks.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck