作者ruby0104 (:))
看板Database
标题Re: [SQL ] 两个SQL语法要合并写在一起
时间Tue Sep 4 13:09:42 2007
※ 引述《diamondking (天剑流星)》之铭言:
: 其实有比较简单的写法:
: select a.StuName,
: sum(datediff(hh,b.StartTime,b.EndTime)) Hours,
: sum(datediff(hh,b.StartTime,b.EndTime))*100 Bonus
: from Student a left outer join Spell b on a.StuID=b.SpellStuID
: where b.YearMonth=200708 and a.UnitID=123
: group by a.StuName
: 大致上是这样,t-sql的语法不是很肯定,有错请指正
但是如果同一个班级 有两个同名同姓的人 就不能这样做了啊
虽然说原PO本来的2就是用StuName :)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 71.132.195.187