多个结果集union后保持各自原有排序
SELECT *
FROM (
SELECT TOP (@count1) a.* FROM Article AS a WITH (NOLOCK)
LEFT JOIN Article_Type AS at WITH (NOLOCK)
ON a.ArticleType=at.ArticleTypeId
WHERE a.IsDelete=0 AND a.Status=0
AND at.ArticleTypeId=@articleType1---条件变换
AND a.IssueTime<GETDATE()
ORDER BY a.IssueTime DESC,a.ArticleType ASC
) t
UNION ALL
SELECT *
FROM (
SELECT TOP (@count2) a.* FROM Article AS a WITH (NOLOCK)
LEFT JOIN Article_Type AS at WITH (NOLOCK)
ON a.ArticleType=at.ArticleTypeId
WHERE a.IsDelete=0 AND a.Status=0
AND at.ArticleTypeId=@articleType2---条件变换
AND a.IssueTime<GETDATE()
ORDER BY a.IssueTime DESC,a.ArticleType ASC
) t
UNION ALL
SELECT *
FROM (
SELECT TOP (@count3) a.* FROM Article AS a WITH (NOLOCK)
LEFT JOIN Article_Type AS at WITH (NOLOCK)
ON a.ArticleType=at.ArticleTypeId
WHERE a.IsDelete=0 AND a.Status=0
AND at.ArticleTypeId=@articleType3 ---条件变换
AND a.IssueTime<GETDATE()
ORDER BY a.IssueTime DESC,a.ArticleType ASC
) t