• 主页
• 基础类
• 应用实例
• 新技术前沿

# 有一个算法困扰我了.不知道难不难，我是被绕住了。

xiaoku 2008-01-10 05:41:34
``````

t
ID int 唯一记录标示
MediaID varchar(10) 媒体ID,
BusID int 站点ID,
Start datetime ,媒体使用开始时间
End datetime ,媒体使用结束时间

ID		MediaID		BusID		start			end
1		'a'			1			'2008-01-01'	'2008-01-15'
2		'b'			1			'2008-01-16'	'2008-01-31'
3		'c'			1			'2008-02-01'	'2008-02-29'
4		'a'			1			'2008-02-01'	'2008-02-29'

create table t
(
ID int identity(1,1) ,
MediaID varchar(10),
BusID int ,
start datetime ,
[end] datetime ,
status int ,		--记录是否被优化过
)
insert into t select 'a',1,'2007-12-01','2008-01-15',0
insert into t select 'a',1,'2008-02-16','2008-03-15',0
insert into t select 'a',1,'2008-05-01','2008-05-31',0
insert into t select 'b',1,'2008-01-16','2008-02-15',0
insert into t select 'b',1,'2008-04-01','2008-04-15',0
insert into t select 'c',1,'2007-12-16','2008-01-15',0
insert into t select 'c',1,'2008-03-16','2008-04-15',0
insert into t select 'd',1,'2008-01-01','2008-01-31',0
insert into t select 'd',1,'2008-03-01','2008-03-31',0
insert into t select 'e',1,'2008-01-01','2008-01-31',0
insert into t select 'f',1,'2008-02-16','2008-03-31',0
insert into t select 'g',1,'2008-05-01','2008-05-31',0
insert into t select 'h',1,'2008-02-01','2008-02-29',0
insert into t select 'i',1,'2008-04-01','2008-04-30',0
insert into t select 'j',1,'2008-02-01','2008-02-15',0

a    ————————————————————		——————————————			   ——————————
b					 ————————————————			 ————————
c		   ——————————————				   ——————————————
d				  ——————————		   ——————————
e				  ——————————
f								—————————————————
g														  ————————————
h							————————————
i												  ——————————
j							——————

``````
...全文
334 点赞 收藏 31

31 条回复

xiaoku 2008-03-04

wyb6458 2008-01-11

wyb6458 2008-01-11

cxmcxm 2008-01-11

hujian0606 2008-01-11

xiaoku 2008-01-11

xiaoku 2008-01-11

sdsxlj 2008-01-11

---------

xiaoku 2008-01-11

-----------------
to：wyb6458

gimse7en 2008-01-11

fa_ge 2008-01-11

fulianglove 2008-01-11

xiaoku 2008-01-10

dawugui 2008-01-10

dobear_0922 2008-01-10

xiaoku 2008-01-10

xiaoku 2008-01-10

j 可以 替换成a ,
i 换成 d
...

a，b，c，d，e
5个媒体.

dawugui 2008-01-10

xiaoku 2008-01-10

a ———————————————————— —————————————— ——————————
b ———————————————— ————————
c —————————————— ——————————————
d —————————— ——————————
e ——————————
f —————————————————
g ————————————
h ————————————
i ——————————
j ——————

----------------

xiaoku 2008-01-10
hehe... 龟,这个带点的是表示半个月的说法.

g媒体,可以替换成b媒体,以达到b的最大利用率.

MS-SQL Server

3.2w+

MS-SQL Server相关内容讨论专区