Your data isn't correct. In table2, you have multiple IDs in some of the rows:
table2:
|-----------|-----------|
| Studyarea | CourseID |
|-----------|-----------|
| 1 | 1,2 |
| 2 | 2 |
| 3 | 2,3 |
|-----------|-----------|
This is incorrect. Each row should only have one ID per column. If a Studyarea has more than one CourseID, then there will be more than one row with that Studyarea:
table2:
|-----------|-----------|
| Studyarea | CourseID |
|-----------|-----------|
| 1 | 1 |
| 1 | 2 |
| 2 | 2 |
| 3 | 2 |
| 3 | 3 |
|-----------|-----------|
Now you can leave the IDs as concatinated strings, but that breaks database design and requires more work. What you would have to do is use a query to merge the table1 and table2 data, split the values out of the CourseID values, and execute additional queries. I can't see anyone designing a database this way unless they had no idea what they were doing. Is there a reason why you want it to be this way?
P.S. Use code tags ([code][/code]) so that your data looks nice. It's hard to look at your data when it doesn't line up.