select top 10 * from 表 where uid not in ('23','32') order by hits desc

解决方案 »

  1.   

    Select TOP 10 * from TableName Where UID <>23 And UID <>32 Order By HITS Desc
      

  2.   

    select top 10 * from 表
    where uid not in(23,32)
    order by HITS desc
      

  3.   

    存储过程的话Create Procedure List
    AS
    Select TOP 10 * from TableName Where UID <>23 And UID <>32 Order By HITS Desc 
    GO
      

  4.   

    select top 10 * from 表
    where uid not in(23,32)
    order by HITS desc
      

  5.   

    --如果要加上排行的名称的话select top 10 *,名称=(select count(distinct HITS) from 表 where HITS>=a.HITS)
    from 表 a
    where uid not in(23,32)
    order by HITS desc
      

  6.   

    应加上uid NOT IN (23, 32)
    SELECT TOP 10 *,
              (SELECT COUNT(DISTINCT HITS)
             FROM table1
             WHERE HITS >= a.HITS AND uid NOT IN (23, 32)) AS 名次
    FROM TABLE1 a
    WHERE (uid NOT IN (23, 32))
    ORDER BY hits DESC