select * from (select top 1 '最大值',* from 表 order by 数值 desc) a
union all
select * from (select top 1 '最小值',* from 表 order by 数值) a

解决方案 »

  1.   

    聚合函数
    Microsoft SQL Server 2000 Analysis Services 提供下面的聚合函数以便在度量值中使用。聚合函数 返回值 
    Sum 输入值之和。 
    Min 最小输入值。 
    Max 最大输入值。 
    Count 输入值的数目。 
    Distinct Count 不重复的输入值的数目。 
      

  2.   

    select * from [table] where 数值=(select max(数值) from [table])or 数值=(select min(数值) from [table])
      

  3.   

    1.
    select * from 表 where 序号 = 
    (select max(a.序号) from 表 a where a.名称 = 名称)
    union all
    select * from 表 where 序号 = 
    (select min(a.序号) from 表 a where a.名称 = 名称)2. 
    select top 1 * from 表 where 名称 = 'A'
    order by 序号 desc
    union all
    select top 1 * from 表 where 名称 = 'A'
    order by 序号 asc
      

  4.   

    select max(数值) 最大值 from 表名 order by 数值
    select min(数值) 最小值 from 表名 order by 数值
      

  5.   

    select * from (select top 1 '最大值' as 取值类别,* from 表 order by 数值 desc) a
    union 
    select top 1 '最小值',* from 表 order by 数值
      

  6.   

    select * from (select top 1 * from table8 order by 数值 desc ) a
    union all
    select * from (select top 1 * from table8 order by 数值) b
      

  7.   

    select fld1,fld2,max(fld3) from tableA 
    union 
    select fld1,fld2,min(fld3) from tableA
      

  8.   

    select fld1,fld2,max(fld3) as fld3 from tableA 
    union 
    select fld1,fld2,min(fld3) as fld3 from tableA