如何显示这样的网格数据 [英] How to show grid data like this
问题描述
嗨朋友们,
我有一个问题
我的网格有栏目
-Name ------------来自-------------至--------- ----价格---
舒适度8/8/2012 8/9/2012 50.00
Amenity 8/6/2012 8/7/2012 50.00
Amenity 8/9/2012 8/10/2012 50.00
Amenity two 2012年7月28日7/31/2012 0.00
便利设施2 8 / 3/2012 8/4/2012 0.00
------------------------ --------------------------------
现在我的问题是如何才能在我的前端获得这种结构
-Name ------------来自----- -------- To ------------- Rate ---
Amenity 8/8/2012 8/9/2012 50.00
8/6/2012 8/7/2012 50.00
8/9/2012 8/10/2012 50.00
Amenity two 7/28/2012 7 / 31/2012 0.00
8/3/2012 8/4/2012 0.00
---------- ----------------------------------------------
名字中的重复我只想展示一次
我该怎么办
plz帮助我
Hi friends,
I have a question
my grid have column
-Name------------From-------------To-------------Rate---
Amenity 8/8/2012 8/9/2012 50.00
Amenity 8/6/2012 8/7/2012 50.00
Amenity 8/9/2012 8/10/2012 50.00
Amenity two 7/28/2012 7/31/2012 0.00
Amenity two 8/3/2012 8/4/2012 0.00
--------------------------------------------------------
now my question is this that how can i get this structure at my front end
-Name------------From-------------To-------------Rate---
Amenity 8/8/2012 8/9/2012 50.00
8/6/2012 8/7/2012 50.00
8/9/2012 8/10/2012 50.00
Amenity two 7/28/2012 7/31/2012 0.00
8/3/2012 8/4/2012 0.00
--------------------------------------------------------
the duplication in Name i just want to show it just one time
how can i do this
plz help me
推荐答案
您可以在MS SQL服务器端执行以下查询:
You can do this on MS SQL server side with following query:
declare @table table
(
Name varchar(20),
[From] Date,
[To] Date,
Rate decimal
)
insert into @table values('Amenity', '8/8/2012', '8/9/2012', 50)
insert into @table values('Amenity', '8/6/2012', '8/7/2012', 50)
insert into @table values('Amenity', '8/9/2012', '8/10/2012', 50)
insert into @table values('Amenity two', '7/28/2012', '7/31/2012', 0)
insert into @table values('Amenity two', '8/3/2012', '8/4/2012', 0)
select
case when number = 1 then Name else '' /*or null*/ end as Name, [From], [To], Rate
from (
select
row_number() over(partition by Name order by Name desc) number,
Name, [From], [To], Rate
from @table
) [inner]
听起来像是在寻找类似的东西: 从网格视图中消除重复值 [ ^ ]
退房!
Sounds like you are looking for something like: Eliminate Duplicate Values from the Grid View[^]
Check out!
这篇关于如何显示这样的网格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!