troubleshooting Question

SQL Server How-To Show Notes In First Row of Results

Avatar of newtoperlpgm
newtoperlpgmFlag for United States of America asked on
Microsoft SQL Server
4 Comments1 Solution91 ViewsLast Modified:
I have a simple query that joins six tables to retrieve the desired data on PersonID.  I need to include Notes from a separate Notes table.  I only want the notes to appear once in the result set, how can I achieve that?  In the data, I join the Notes table and Table1 on PersonID.  I only want to show Note1 in the data set below on row 1 IF the Notes are the same, as in the example.  If the Notes are different, for example where it is Note2, then I want to display it in my query.   The sample of data is below:
PersonID     Name     Address     Phone     Email    AcctNumber     SomeDate     EndDate    ExpensePayment     Notes
12345          Joe           123 Yam    55555     a@b.com 123999          02/02/2017    03/04/2017    27.99                     Note1
12345          Joe            123 Yam   55555     a@b.com  12399           02/02/2017    05/23/2017    15.23                     Note1
12345          Joe            123 Yam   55555     a@b.com   12399          04/03/2017    04/04/2017     5.99                      Note2

Thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros