EDIT: Adding Code reduction to make query clearer:
Select
AMS.arecno As [RecNo],
Convert(DATE,AMS.adate) As [Date],
ac.acommentno as [commentno],
ac.acomment as [comments]
From
amain As AMS
left Join
asfat As ASF On AMS.arecno = ASF.afatrecno
left join
acomments as ac on ac.areportno = asf.afatrecno
Order By
AMS.arecno Desc
My first table has this type of info:
recno | date
1234 | 2017
6548 | 2018
I am then left joining on a table called comments. Per record number (recno) there are multiple comments.
like this:
recno | commentno | comments
1234 | 1 | blah blah...
1234 | 2 | doot doot...
6548 | 1 | jib jab...
6548 | 2 | flib flob...
I'd like to show this:
recno | date | comments |
1234 | 2017 | Comment 1: blah blah... Comment 2: doot doot...
6548 | 2018 | Comment 1:jib jab... Comment 2: flib flob...
I've looked up and tried a few solutions but am really struggling. Any help would be much appreciated.
Note: I can't create any tables or stored procedures due to limitations on our ODBC setup and have a very limited sql knowledge compared to most.