I have two tables in MSSQL Server 2012 and would like to combine them into one new table. They are linked by the column messageID. The first table (Message) has
messageID
sender
date
The second table(recipientInfo) has
messageID
recipient
The main problem is that in Message the messageID is the primary key and thus unique. In recipientInfo the messageID is not unique (because one message can have multiple recipients). I’d like to have a new table with either
- One row per message, with recipients concatenated in one column
- Multiple rows per message, when there are multiple recipients (one recipient per row)
Maybe something like this (if you are using MSSQL 2005+):