SqlServer中Distinct和Top一起使用
SELECT distinct top 2 LastName FROM [dbo].[Employees] order by LastName
distinct要放到top前面,这样取出的结果是先将数据Distinct去重复,然后再取其中的前两行
SELECT distinct top 2 LastName FROM [dbo].[Employees] order by LastName
distinct要放到top前面,这样取出的结果是先将数据Distinct去重复,然后再取其中的前两行