我有一個SQL服務器數據庫,我認爲即時通訊有一個連接問題,但它可能不是連接問題。這是一個簡單的存儲過程全外連接不工作
ALTER Proc [dbo].[proc_Time_NotEntered]
(
@sDate datetime,
@eDate datetime
)
AS
BEGIN
Select (e.[emplname] + ', ' + e.[empfName]) as [FullName],
wip.wdate as [date],
Sum(case when wip.wdate between @sDate and @eDate and wip.windicator <> 'D' then wip.[whours] else 0 end) as [Hours],
dept.[DeptName]
From sab.dbo.employee as e
Join sab.dbo.wip as wip on e.[ID] = wip.wempID
join sab.dbo.department as dept on e.empdept = dept.deptID
where
wip.wdate between @sDate and @eDate
and e.[emplname] + ', ' + e.[empfName] <> ' No Selection, '
Group by
e.[emplname],
e.[empfName],
dept.[DeptName],
wip.[wdate]
ORDER BY
-- wip.[wdate],
e.[emplname] + ', ' + e.[empfName]
return 1
END
隨着我國加入我都試過全外連接並獲得相同的結果。
我正在努力實現的目標:即使他們每天都沒有時間,我也想讓所有的員工都能夠成功。
這不就是左連接嗎?完全外部連接會給你幾個小時沒有員工,我懷疑你的數據模型是否合理? –
不,它不是,我只是想讓所有的員工,然後我會擔心的時間。 – user3120232