rickjamesb
MIS
I need to search for ProductIDs and UnitPrices for products that have not been sold within the past six months. The six months is determined by the date the Stored Procedure is executed.
So i guess i would just need to find the current server time, do some type of interval of 6 months, and use a NOT IN statement?
How do i find the current server time? Is my WHERE statement anywhere close to being correct? I have no experience with working with dates in SQL - looking for a good online tutorial.
So i guess i would just need to find the current server time, do some type of interval of 6 months, and use a NOT IN statement?
How do i find the current server time? Is my WHERE statement anywhere close to being correct? I have no experience with working with dates in SQL - looking for a good online tutorial.
Code:
SELECT ProductID, UnitPrice
FROM Products
WHERE ProductID NOT IN
(SELECT ProductID
FROM Products
WHERE DateDiff(Month, 'CURRENT TIME', OrderDate > 6)