SELECT DISTINCT mtype
FROM wos_menu order by mid

解决方案 »

  1.   

    order by 字段1,字段2,字段3......................
      

  2.   

    SELECT mtype FROM wos_menu group by mtype order by min(mid)
      

  3.   

    order by 字段 asc   --正序order by 字段 desc  --倒序
    select distinct mtype from wos_menu order by mid asc或select distinct mtype from wos_menu order by mid desc
      

  4.   

    1.An ORDER BY clause is invalid in views, derived tables, and subqueries unless TOP is also specified.
    2.ORDER BY items must appear in the select list if SELECT DISTINCT is specified.SO YOU MUST DO LIKE THIS:
    select mtype into #T from wos_menu order by mid
    select distinct mtype from #T
    ----OR------
    select distinct mtype from 
        (Select distinct mtype,mid from wos_menu order by mid) A
      

  5.   

    order by 字段 asc   --升序
    ----------------------------
    SELECT DISTINCT mtype
    FROM wos_menu 
    ORDER BY mid ASC
    order by 字段 desc  --降序
    ------------------------------
    SELECT DISTINCT mtype
    FROM wos_menu 
    ORDER BY mid DESC
      

  6.   

    SELECT DISTINCT mtype
    FROM wos_menu order by mid
    服务器: 消息 145,级别 15,状态 1,行 1
    如果指定了 SELECT DISTINCT,那么 ORDER BY 子句中的项就必须出现在选择列表中。
    ----------------------
    SELECT mtype FROM wos_menu group by mtype order by min(mid)
    高手!!!
      

  7.   

    select mtype from wos_menu order by mid
      

  8.   

    谢谢pengdali(大力 V2.0)
    SELECT  mtype  FROM  wos_menu  group  by  mtype  order  by  min(mid)
      

  9.   

    SELECT mtype FROM wos_menu group by mtype order by min(mid)