For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas.
Thanks.
Best Solution
Assuming you're using SQL Server 2005:
This should do what you're after - obviously replace fields as you need:
For demo purposes, consider the following two table structures:
Now this query should do the job you're after:
Way simpler than the currently accepted answer...