SELECT ft.ThreadTitle AS Title,
fr.ReplyText + ' ' + ua2.Username + ' ' + ft.ThreadText + ' ' +
(Select ReplyText from ForumReply Where ThreadID=ft.ThreadID)
AS [Content],
ss.Domain,
ss.SiteID,
ft.ThreadID AS ObjectId
FROM dbo.ForumReply AS fr INNER JOIN
dbo.ForumThreads AS ft ON fr.ThreadID = ft.ThreadID INNER JOIN
dbo.User_Account AS ua1 ON ft.CreateByUserID = ua1.UserID INNER JOIN
dbo.User_Account AS ua2 ON fr.ReplyUserID = ua2.UserID INNER JOIN
dbo.SysT_Site AS ss ON ua1.SiteID = ss.SiteID
This query gives an error: The subquery returned more than 1 value. This is unacceptable when a subquery follows = ,! =, <, <=,>,> = or when the subquery is used as an expression.
How can I rewrite this query to work to get all values in one variable? The end result should be “View”, which looks like this:
.ObjectID int
.Content (a string with all the text that exists in Forumthread.threadText and forumReply.ReplyText)
.Domain string
.SiteID int
source
share