所以我的问题是,我必须制定一个程序,将产品表中的所有价格乘以0.8,如果产品没有售出X数量几个月。存储过程给予“折扣”基于X从今天的月份数量
目前,我似乎无法得到任何进一步的比这
GO
CREATE PROC newprice(@numberofmonth int)
AS
BEGIN
DECLARE @today datetime
SET @today = GetDate()
SELECT product.productid, product.name
FROM orders JOIN orderitem on orderitem.orderid = orders.orderid
JOIN product on product.productid = orderitem.productid
WHERE orders.orderdate > (SELECT DATEADD(month, [email protected], @today))
UPDATE product set price = price * 0.8 where
END
希望一切是足够透明的阅读,没有任何进一步的说明了解。我正在使用SQL Server。
奏效完美。非常感谢 – MrBawsEnough