我确信这是基本的,但我尝试了几种不同的方式来搜索StackOverflow以从c.CallStartWhen
和c.CallTime
中删除日期。两者都是datetime
列。
SQL Server 2017
Select Distinct
c.IncNo, c.CallStartWhen, c.CallTime,
(c.CallTime - c.CallStartWhen) as difference1
From
(Select
a.IncNo, a.CallStartWhen, b.CallTime
From
tblClosedCalls a
Right Join
tblUnitCallTimes b on b.IncNo = a.IncNo
Where
b.CallDate Between '1/1/2010' And '1/2/2010'
And b.Status = '1') c
非常感谢任何帮助。