Re: [SQL ] 兩個SQL語法要合併寫在一起

看板Database作者 (:))時間18年前 (2007/09/04 13:09), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/9 (看更多)
※ 引述《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
文章代碼(AID): #16tEYNf3 (Database)
討論串 (同標題文章)
文章代碼(AID): #16tEYNf3 (Database)