I have a problem with an SQL server query.
The error that I am getting is the subquery return more than one value.This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The following is my query :
I have a temporary report table called ReportsAdditionalComment
I am doing an update in this temp table and selecting additional comments.Now the problem is when the following statement runs inside the stored procedure it returns the above error of subquery returned more than one value.Obviously, I can make out since I am setting out into one variable , it will not accept if the inner query returns more than one row.But I don't know how to modify the SET part of this query so that it can return more than one Row.I need to have multiple comments returned and set in ADD_COMMENTS.
SET ADD_COMMENTS = (SELECT RE.REMARKS
FROM ReviewEvent RE
WHERE RE.PROJECT_ID = @PROJ_ID
AND RE.REPOINT_ID = @REPOINT_ID
AND RE.REVIEW_DATE = @REVIEW_DATE
The type of ADD_COMMENTS is VARCHAR(1000).
I hope I have explained it clearly.I seemed to be stuck on this for the last two days and since I am a novice in SQL , I really don't know what could be the solution.By the way the inner SQL query executes perfectly and returns two rows but I don't know how to set up multiple rows in ADD_COMMENTS .Please Help.