Subquery may return more than one row.
A subquery can only be scalar, meaning that it can return just one value. Even if you correctly place just one expression in your select list, you must also ensure that just one row is returned. TOP 1 can be used if there is an ORDER BY clause
where里面有一个条件是进行比较
AND CustomTableItemID > ( SELECT ISNULL(MAX(MessageID), 0) FROM dbo.tbm_mms_MemberMessage WHERE MemberID = @MemberID --ORDER BY MemberID )
这里的比较需要加上order by,当然也可以附加top(1)