单列DISTINCT使用Row_NUMBER()

时间:2015-02-10 07:13:21

标签: sql-server sql-server-2008 sql-server-2008-r2

我使用DISTINCT和ROW_NUMBER()进行MSSQL查询,

QUERY IS:

    SELECT * from 
(select ROW_NUMBER() OVER  (ORDER BY  b.tc_priority ) AS row,
DISTINCT a.tc_id 
from release_details a, tc_details b 
where a.tc_id=b.tc_name 
and 
tst_system is null 
and release_name='sdkfei' 
and tenv_id='32' 
and env_id='32' 
and tst_type='21' 
and b.autotech='ITL' 
and a.project=b.project 
and a.project='JupiterQA' 
and depclosed=1) AS tab12
 WHERE row BETWEEN 1 AND 5

错误是: 关键字' DISTINCT'

附近的语法不正确

此查询有问题吗?

0 个答案:

没有答案