--建表sqlcreate database test
--表1
create table tb1
(
tId int,
tTime datetime primary key(tId,tTime),
tWaterLevel decimal --水位
)
--表2
create table model
(
m_tId int,
m_wwl decimal,--警戒水位
m_ewl decimal,--保证水位
)insert into tb1(tId,tTime,tWaterLevel)
select 1,'2010-4-14 8:09:20',2
union all
select 1,'2010-4-14 18:09:20',2
union all
select 2,'2010-4-14 18:49:20',3
union all
select 3,'2010-4-14 18:49:20',4insert into model(m_tId,m_wwl,m_ewl)
select 1,1,0.8
union all
select 2,2,1.8
union all
select 3,5,3
--数据显示--数据显示
                   今日八时水情                                     最新水情
编号id        水位    比警戒水位   比保证水位    水位          时间              比警戒水位   比保证水位
1             2         1           1.2            2     2010-4-14 18:09:20         1           1.2
2 ...
3 ...今日八时:tTime时间在(8:00-8:15都算今日八时)
比警戒/保证水位:tWaterLevel-m_wwl, tWaterLevel-m_ewl