select sum(SCM_StockBillDtl.Qty) as ddd ,MONTH(SCM_StockBill.BillDate) from SCM_StockBill,SCM_StockBillDtl where SCM_StockBill.BillID=SCM_StockBillDtl.BillID group by SCM_StockBillDtl.ItemID,MONTH(SCM_StockBill.BillDate) order by sum(SCM_StockBillDtl.Qty)DESC
我这个是取的所有月份的,谢谢大侠们
我这个是取的所有月份的,谢谢大侠们
上面那个少了个时间参数,具体的你看看dateadd()函数你就知道了
where 时间=convert(varchar(10),dateadd(yy,1,getdate()),126)
from SCM_StockBill,SCM_StockBillDtl where SCM_StockBill.BillID=SCM_StockBillDtl.BillID and SCM_StockBill.BillDate =convert(varchar(10),dateadd(yy,getdate()),126)
group by SCM_StockBillDtl.ItemID order by sum(SCM_StockBillDtl.Qty)DESC 这样写吗 不对