Link to home
Start Free TrialLog in
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?
ASKER CERTIFIED SOLUTION
Avatar of dsacker
dsacker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Soumi Chakraborty
Soumi Chakraborty

ASKER

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

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