Кажется, не работает с этим
Добавлен полный код, чтобы понять, что я пытаюсь сделать
Select
Distinct(pick.pick_start_time) as Start time
picker.pic_name As Picker,
Count(distinct(order_header.oh_order_number) As [Order QT],
Sum(pick_line.pickl_quantity) As [Total items],
SUM(DateDiff(MINUTE,MIN(pick_start_time),MAX(pick_end_time)) AS [Pick Total]
From delivery_header
Inner Join
(((pick_line
Inner Join
pick On pick_line.pickl_pick_id = pick.pick_id)
Inner Join
picker On pick.pick_pic_id = picker.pic_id)
Inner Join
(pack
Inner Join
pack_line On pack.pack_id = pack_line.pl_pack_id) On pick_line.pickl_id =
pack_line.pl_pickl_id) On delivery_header.dh_pack_id = pack.pack_id
Inner Join
order_header On order_header.oh_id = delivery_header.dh_oh_id
Where pick.pick_end_time >= @DateFrom And pick.pick_end_time <= @DateTo And
(pick.pick_pic_id = @picker Or @AllPickers = 1)
Group By picker.pic_name
Order By picker.pic_name