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 123999          02/02/2017    03/04/2017    27.99                     Note1
12345          Joe            123 Yam   55555  12399           02/02/2017    05/23/2017    15.23                     Note1
12345          Joe            123 Yam   55555   12399          04/03/2017    04/04/2017     5.99                      Note2

Thank you.
Shalu M

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 4 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004