大致表结构如下.
id type values
0 0 红茶
1 0 绿茶
2 0 奶茶希望结果如下.
type values
0 红茶
绿茶
奶茶disitinct关键字 不符合要求, 暂时毫无头绪.!!
希望各路豪杰 帮帮忙啊,!!SQL
id type values
0 0 红茶
1 0 绿茶
2 0 奶茶希望结果如下.
type values
0 红茶
绿茶
奶茶disitinct关键字 不符合要求, 暂时毫无头绪.!!
希望各路豪杰 帮帮忙啊,!!SQL
解决方案 »
- 求一个aspnetpager+Datalist的例子,要求如下!
- 项目源文件及数据保密问题
- 为什么VS2005只有发布才有DLL生成呀.编译就没有
- 在GridView控件内EditItemTemplate上做了一个关连出错!
- 问一个简单的正则表达式怎么写?
- 在.net中怎么实现在静态页面(.html)中实现提交帖子,提交完毕后再显示帖子的列表?
- 用Dcom调用Word的时候出错:拒绝访问
- 请教哪里有.......
- UltraWebTree的问题????
- 这个错误Could not load type 'namespaceName.className'.是那里出错了?
- NPOI2.0在网页中输出时为什么会打不开?
- asp.net导出excel数据表时页面关闭!
where [type] = 0
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茶