Hi
I thought I had sorted this from an earlier post but looks like I have not. I have this query which up until 2 hours ago was working fine.
it was giving the daterequired starting from todays date, now it is giving tomorrow date?
Could someone advise why this is happening, it should display 2015-06-16 but it is starting at 2015-06-17
SELECT TOP (100) PERCENT dbrderHeader.DateRequired, ProductGroup_1.Name AS [Level 1], dbo.ProductGroup.Name AS [Level 2], SUM(dbrderLine.TotalVolume)
AS [Total Volume]
FROM dbrderHeader INNER JOIN
dbrderLine ON dbrderHeader.OrderID = dbrderLine.OrderID INNER JOIN
dbo.Product ON dbrderLine.ProductID = dbo.Product.ProductID INNER JOIN
dbo.ProductGroup ON dbo.Product.ProductGroupID = dbo.ProductGroup.ProductGroupID INNER JOIN
dbo.ProductGroup AS ProductGroup_1 ON dbo.ProductGroup.ParentID = ProductGroup_1.ProductGroupID
WHERE (dbrderHeader.StockIssued = 0) AND (ProductGroup_1.Name = 'Arborflor') AND (dbrderHeader.DateRequired >= GETDATE() - 1) OR
(dbrderHeader.StockIssued = 0) AND (dbrderHeader.DateRequired >= GETDATE() - 1) AND (dbo.ProductGroup.Name IN ('mouldings', 'loose stock', 'Spindles',
'Newels', 'Handrail Kits', 'DeckAncillaries', 'DeckPosts', 'DeckRails', 'MDF Loose', 'Length stocks', 'MDF architraves loose', 'MDF skirtings loose',
'MDF windowboard loose')) AND (dbrderHeader.DateRequired >= CAST(GETDATE() - 1 AS DATE)) AND (dbrderHeader.DateRequired <= DATEADD(day, 7,
CAST(GETDATE() - 1 AS DATE)))
GROUP BY dbrderHeader.DateRequired, dbo.ProductGroup.Name, ProductGroup_1.Name
ORDER BY dbrderHeader.DateRequired
Thanks
I thought I had sorted this from an earlier post but looks like I have not. I have this query which up until 2 hours ago was working fine.
it was giving the daterequired starting from todays date, now it is giving tomorrow date?
Could someone advise why this is happening, it should display 2015-06-16 but it is starting at 2015-06-17
SELECT TOP (100) PERCENT dbrderHeader.DateRequired, ProductGroup_1.Name AS [Level 1], dbo.ProductGroup.Name AS [Level 2], SUM(dbrderLine.TotalVolume)
AS [Total Volume]
FROM dbrderHeader INNER JOIN
dbrderLine ON dbrderHeader.OrderID = dbrderLine.OrderID INNER JOIN
dbo.Product ON dbrderLine.ProductID = dbo.Product.ProductID INNER JOIN
dbo.ProductGroup ON dbo.Product.ProductGroupID = dbo.ProductGroup.ProductGroupID INNER JOIN
dbo.ProductGroup AS ProductGroup_1 ON dbo.ProductGroup.ParentID = ProductGroup_1.ProductGroupID
WHERE (dbrderHeader.StockIssued = 0) AND (ProductGroup_1.Name = 'Arborflor') AND (dbrderHeader.DateRequired >= GETDATE() - 1) OR
(dbrderHeader.StockIssued = 0) AND (dbrderHeader.DateRequired >= GETDATE() - 1) AND (dbo.ProductGroup.Name IN ('mouldings', 'loose stock', 'Spindles',
'Newels', 'Handrail Kits', 'DeckAncillaries', 'DeckPosts', 'DeckRails', 'MDF Loose', 'Length stocks', 'MDF architraves loose', 'MDF skirtings loose',
'MDF windowboard loose')) AND (dbrderHeader.DateRequired >= CAST(GETDATE() - 1 AS DATE)) AND (dbrderHeader.DateRequired <= DATEADD(day, 7,
CAST(GETDATE() - 1 AS DATE)))
GROUP BY dbrderHeader.DateRequired, dbo.ProductGroup.Name, ProductGroup_1.Name
ORDER BY dbrderHeader.DateRequired
Thanks