大致表结构如下. 
 id      type      values
  0       0          红茶
  1       0          绿茶
  2       0          奶茶希望结果如下.
 type       values
  0          红茶
             绿茶
             奶茶disitinct关键字 不符合要求, 暂时毫无头绪.!!
   希望各路豪杰 帮帮忙啊,!!SQL

解决方案 »

  1.   

    select [values] from t_table 
    where [type] = 0
      

  2.   


    declare @tab table
    (
    id int,
    [type] int,
    [values] nvarchar(50)
    )insert into @tab(id,[type],[values])
    select 0,0,'红茶' union all
    select 1,0,'绿茶' union all
    select 2,0,'奶茶' union all
    select 3,1,'a茶' union all
    select 4,1,'b茶' union all
    select 5,1,'c茶' select case when pg=1 then [type] else null end as [type],[values] from
    (
    select row_number() over(partition by [type] order by id asc) as pg,* from @tab
    ) t
    /-********-/
    type    values
    0 红茶
    NULL 绿茶
    NULL 奶茶
    1 a茶
    NULL b茶
    NULL c茶
      

  3.   

    Select values,count(1) From tb Group by values ?这个意思