S
sharpwing
Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT [brown]'类型'[/brown]=case when t.fnumber < '01.02' then '脚力'
when t.fnumber between '01.02' and '01.03' then '梯子'
when t.fnumber between '01.03.CSB0' and '01.03.CSBZ' then 'CSB'
when t.fnumber between '01.03.VSS0' and '01.03.VSSZ' then 'VSS'
when t.fnumber between '01.03.CSR0' and '01.03.CSRZ' then 'CSR'
else 'other' end,
t.FNumber AS 物料代码, t.FName AS 物料名称,
SUM(CASE day(s.fadviceconsigndate) WHEN '01' THEN s.fauxqty ELSE 0 END)
AS '1',
*********
SUM(CASE day(s.fadviceconsigndate) WHEN '31' THEN s.fauxqty ELSE 0 END)
AS '31',sum(s.fauxqty) as 合计
FROM dbo.SEOrderEntry s INNER JOIN
dbo.SEOrder so ON s.FInterID = so.FInterID INNER JOIN
dbo.t_ICItem t ON s.FItemID = t.FItemID
WHERE (MONTH(s.FAdviceConsignDate) =3) AND (YEAR(s.FAdviceConsignDate) = 2007)
GROUP BY t.FNumber, t.FName
ORDER BY t.FNumber, t.FName
中怎么样根据“类型”对s.faunqty分组求和。谢谢。答题有分。
when t.fnumber between '01.02' and '01.03' then '梯子'
when t.fnumber between '01.03.CSB0' and '01.03.CSBZ' then 'CSB'
when t.fnumber between '01.03.VSS0' and '01.03.VSSZ' then 'VSS'
when t.fnumber between '01.03.CSR0' and '01.03.CSRZ' then 'CSR'
else 'other' end,
t.FNumber AS 物料代码, t.FName AS 物料名称,
SUM(CASE day(s.fadviceconsigndate) WHEN '01' THEN s.fauxqty ELSE 0 END)
AS '1',
*********
SUM(CASE day(s.fadviceconsigndate) WHEN '31' THEN s.fauxqty ELSE 0 END)
AS '31',sum(s.fauxqty) as 合计
FROM dbo.SEOrderEntry s INNER JOIN
dbo.SEOrder so ON s.FInterID = so.FInterID INNER JOIN
dbo.t_ICItem t ON s.FItemID = t.FItemID
WHERE (MONTH(s.FAdviceConsignDate) =3) AND (YEAR(s.FAdviceConsignDate) = 2007)
GROUP BY t.FNumber, t.FName
ORDER BY t.FNumber, t.FName
中怎么样根据“类型”对s.faunqty分组求和。谢谢。答题有分。