求一SQL - MS-SQL Server / 基础类
表如下
教室ID 座位数 开始时间 结束时间 2009年1月1日 2009年1月2日 2009年1月3日
101 50 08:00 08:30 30 40 50
101 50 09:00 09:30 30 40 50
101 50 09:30 10:30 30 40 50
计算这个教室的饱和度
教室ID 座位数 开始时间 结束时间 2009年1月1日 2009年1月2日 2009年1月3日 饱和度
101 50 08:00 08:30 30 40 50 xx.xx%
101 50 09:00 09:30 31 41 51 xx.xx%
101 50 09:30 10:30 32 42 52 xx.xx%
饱和度计算公式
∑(时段(分钟) × 每天的人数)/ 座位数×(∑(时段))
(30×(30+40+50)+ 30 ×(31+41+51)+ 60×(32+42+52))/ 50×(30+30+60)
看不明白!
SQL code:
SELECT * ,
饱和度 = (30×(30+40+50)+ 30 ×(31+41+51)+ 60×(32+42+52))/ 50×(30+30+60)
from TB
SQL code:
SELECT * ,
饱和度 = cast( ( (30×(30+40+50)+ 30 ×(31+41+51)+ 60×(32+42+52))) *100.00 / 50×(30
相关问答:
本人c#新手 可是要求要用c# ,sql2000开发c/s的工作流,一头雾水,请大家帮忙帮忙,给点思路,说的约具体越好,我也好往那个方面去学习
http://www.hxzi.com/view/61402.html
B/S版的,基本思想应该差不多的。。 ......
小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
大家帮忙看看这2个sql语句哪个查询的速度更快点。谢谢帮忙。比较着急。在做性能测试。
select * from
表A LEFT OUTER JOIN 表B ON (表A.id || ' ' =表B.id) ,表C , 表D, 表E
Where其他条件
select * ......
(1)string ConnString = "server=localhost;integrated security=sspi;database=pubs;";
(2)string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......