help with SQL

I have a job table.  3 columns.   ID, type, and notes.    I want to return one record for each set of records per type, where the notes are merged into one note column. How can I do this?
LVL 1
HLRosenbergerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ste5anConnect With a Mentor Senior DeveloperCommented:
E.g.

SELECT  DISTINCT P.Color ,
        STUFF(( SELECT  DISTINCT ', ' + I.NAME
                FROM    AdventureWorks2012.Production.Product I
                WHERE   I.Color = P.Color
                FOR XML PATH('')
             ), 1, 2, '')
FROM    AdventureWorks2012.Production.Product P
WHERE   NOT P.Color IS NULL;

Open in new window

0
 
Dan CraciunIT ConsultantCommented:
SELECT type, GROUP_CONCAT(notes SEPARATOR ' ') FROM jobs
GROUP BY type

Open in new window

HTH,
Dan
0
 
HLRosenbergerAuthor Commented:
is GROUP_CONCAT a built in SQL function?  When I try it, I get:

'GROUP_CONCAT' is not a recognized built-in function name.  I'm using MS SQL Server, not MySQL.
0
 
HLRosenbergerAuthor Commented:
This worked perfect.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.