monkeyfather
use BASKET

select prd.PartID,
prd.Quantity,
prd.UnitRetailPrice,
prd.ItemDesc,
inf.orderdate
into #a
from Basket.dbo.BaseOrderItem  prd(nolock)
inner join Basket.dbo.BaseOrderTracker inf(nolock)
on(prd.OrderID=inf.OrderID)
where prd.SectionCode = \'1\'
and prd.UnitRetailPrice > 0
and prd.PartType = \'1\'
and inf.OrderDate >=\'2014-08-01\'
and inf.OrderDate <=\'2014-09-30\'

select * from #a

select PartID,
SUM(Quantity) as Quantity
into #b
from #a
where OrderDate >=\'2014-08-01\'
and OrderDate <=\'2014-08-31\'
group by PartID

select PartID,
SUM(Quantity) as Quantity
into #c
from #a
where OrderDate >=\'2014-09-01\'
and OrderDate <=\'2014-09-30\'
group by PartID

select * from #c

 

分类:

技术点:

相关文章:

  • 2022-02-20
  • 2021-05-20
  • 2022-01-04
  • 2021-06-24
  • 2021-10-19
  • 2021-12-10
  • 2021-11-24
猜你喜欢
  • 2022-02-16
  • 2022-12-23
  • 2021-06-07
  • 2022-01-21
  • 2021-09-05
  • 2021-12-17
  • 2022-02-10
相关资源
相似解决方案