--这样就可以
select top 300 * from (select distinct * from tablename) a

解决方案 »

  1.   

    SELECT DISTINCT TOP 300 invoiceNo from [table]
      

  2.   

    select distinct
    from
    (
    SELECT TOP 300  invoiceNo
    from table
    ) A
      

  3.   

    select distinct *
    from
    (
    SELECT TOP 300  invoiceNo
    from table
    ) A
      

  4.   

    SELECT DISTINCT TOP 300 invoiceNo from [table]
      

  5.   

    SELECT DISTINCT TOP 300  invoiceNo from table1
      

  6.   

    我觉得 aw511(点点星灯) 的方法比较好(除了一点小的笔误(改为select top 300 invoiceNo from (select distinct * from tablename) a)。Hopewell_Go的方法,有点问题.
    如果原表中有600条记录。其中,前300条记录都是相同的话, 那么按Hopewell_Go的方法,则只能选出1条记录, 而按‘点点星灯’的方法则可以选出300条记录。
    而且我想一般来言,‘点点星灯’的方法更接近需求。SELECT DISTINCT TOP 300 invoiceNo from [table],这种方法可能最接近要求。但是效率可能会比较低。个人看法,不当之处,请斧正。
      

  7.   

    SELECT DISTINCT TOP 300 (invoiceNo)
    from table
      

  8.   

    SELECT DISTINCT TOP 300 invoiceNo from [table] 就行了或
    select top 300 invoiceNo from (select distinct * from tablename) a
      

  9.   

    敢问"select distinct * from tablename"是什么意思?
      

  10.   

    select top 300 * from (select distinct invoiceNo from tablename) a还有:
    SELECT DISTINCT TOP 300 invoiceNo from [table],我认为效率很高,也符合需求.
      

  11.   

    --用
    select top 300 * from (select distinct invoiceNo from tablename) a

    SELECT DISTINCT TOP 300 invoiceNo from [table]--在查询分析器中分析两者的执行效率是一样的
      

  12.   

    select top 300 * from (select distinct invoiceNo from tablename) a請教 上名中加“a”是什麼意思?