/*机房计费系统刷卡明细查看SQL代码*/
SELECT consumerec.cardid AS 学工号, dbo.student.stuname AS 姓名,
dbo.dept.dname AS 院系, dbo.grade.gname AS 班级, dbo.room.rname AS 机房,
dbo.computer.cname AS 计算机, consumerec.intime AS 上机时间,
consumerec.outtime AS 下机时间, consumerec.ztime AS [刷卡有效时长(分)],
consumerec.timecost AS 刷卡额
FROM dbo.servers INNER JOIN
dbo.room ON dbo.servers.serverid = dbo.room.serverid INNER JOIN
dbo.computer ON dbo.room.serverid = dbo.computer.serverid AND
dbo.room.roomid = dbo.computer.roomid INNER JOIN
dbo.history consumerec ON dbo.computer.serverid = consumerec.serverid AND
dbo.computer.roomid = consumerec.roomid AND
dbo.computer.compid = consumerec.compid INNER JOIN
dbo.student ON consumerec.cardid = dbo.student.cardid INNER JOIN
dbo.dept ON dbo.student.deptid = dbo.dept.deptid INNER JOIN
dbo.grade ON dbo.dept.deptid = dbo.grade.deptid AND
dbo.student.gradeid = dbo.grade.gradeid