I have a table in SQL Server 2008 like this:
Id Name
------------
1 Jack
2 John
3 Maria
4 Jack
5 Jack
6 John
I am trying to see all the Ids having the same name in one column.
select Count(Id), Name
from myTable
group by Name
The query above is giving me the number of Ids having the same name. But what I would like to see is:
Id Name
------------
1,4,5 Jack
2,6 John
3 Maria
How can I provide this? Thanks