This site uses cookies to deliver our services and to show you relevant ads and job listings.
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
Your use of Stack Overflow’s Products and Services, including the Stack Overflow Network, is subject to these policies and terms.

Join us in building a kind, collaborative learning community via our updated
Code of Conduct.

Stuff allows you to receive one value from a multi row select. Consider my situation below

ID HOUSE_REF PERSON
1 A Dave
2 A John
3 B Bob

I would like to write a select statement, but I want the PERSON names to be in a single row.

For example, when I select from this table, I want to achieve the following

HOUSE_REF PERSONS
A Dave, John
B Bob

I haven't been able to find a simple solution so far, it may be a case of writing my own function to use, but I'm not entirely sure of how to approach this, any ideas?

The main business use of this, will be to have a select statement that shows each house, and against that house to have one column which lists everyone that lives in that house. The house ref in this select must be unique, hence needing to concatenate the persons