use AlplaPROD_test1 declare @start_date nvarchar(30) = '[startDate]' --'2025-01-01' declare @end_date nvarchar(30) = '[endDate]' --'2025-08-09' /* articles will need to be passed over as well as the date structure we want to see */ select x.IdArtikelvarianten As Article, ProduktionAlias as Description, standort as MachineId, MaschinenBezeichnung as MachineName, --MaschZyklus as PlanningCycleTime, x.IdProdPlanung as LotNumber, FORMAT(ProdTag, 'MM/dd/yyyy') as ProductionDay, x.planMenge as TotalPlanned, ProduktionMenge as QTYPerDay, round(ProduktionMengeVPK, 2) PalDay, Status as finished --MaschStdAuslastung as nee from dbo.V_ProdLosProduktionJeProdTag_PLANNING (nolock) as x left join dbo.V_ProdPlanung (nolock) as p on x.IdProdPlanung = p.IdProdPlanung where ProdTag between @start_date and @end_date and p.IdArtikelvarianten in ([articles]) --and V_ProdLosProduktionJeProdTag_PLANNING.IdKunde = 10 --and IdProdPlanung = 18442 order by ProdTag desc