I have a situation where I have a table of records that looks something like (detail removed for brevity):
CREATE TABLE Records (
RecordsId int,
Description varchar(255)
);
I want to add multiple comments for each record using another table such as:
CREATE TABLE Comments (
CommentsId int,
Comment varchar(255)
);
I am aware that I can link the tables using a join statement but how would I effectively retrieve the information if there was one Record with multiple comments attached to it, with no set number of comments?
Such as
RecordsId
Description
- Comment 1
- Comment 2
- Comment 3
- Comment .....
I am aware that I could run a query to get the value of the first table and then run a second query for the second table but this would be extremely slow when I have large numbers of records. I am trying to popullate a C# object with the values.