20 lines
686 B
Transact-SQL
20 lines
686 B
Transact-SQL
use [test1_AlplaPROD2.0_Reporting]
|
|
|
|
declare @startDate nvarchar(30) = '[startDate]' --'2024-12-30'
|
|
declare @endDate nvarchar(30) = '[endDate]' --'2025-08-09'
|
|
|
|
select MachineLocation,
|
|
ArticleHumanReadableId as article,
|
|
sum(Quantity) as Produced,
|
|
count(Quantity) as palletsProdued,
|
|
FORMAT(convert(date, ProductionDay), 'M/d/yyyy') as ProductionDay,
|
|
ProductionLotHumanReadableId as productionLot
|
|
|
|
from [reporting_productionControlling].[ScannedUnit] (nolock)
|
|
|
|
where convert(date, ProductionDay) between @startDate and @endDate
|
|
and ArticleHumanReadableId in ([articles])
|
|
and BookedOut is null
|
|
|
|
group by MachineLocation, ArticleHumanReadableId,ProductionDay, ProductionLotHumanReadableId
|