SQL Server: How to use UNION with two queries that BOTH have a WHERE clause?

后端 未结 7 1523
礼貌的吻别
礼貌的吻别 2020-12-08 14:39

Given:

Two queries that require filtering:

select top 2 t1.ID, t1.ReceivedDate
  from Table t1
 where t1.Type = \'TYPE_1\'
 order by         


        
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 15:18

    The basic premise of the question and the answers are wrong. Every Select in a union can have a where clause. It's the ORDER BY in the first query that's giving yo the error.

提交回复
热议问题