日期:2014-05-17 浏览次数:20599 次
SELECT userguid ,
years ,
[一月产量] = SUM(CASE WHEN infotype = 1
AND ISNUMERIC(firstyield) = 1
THEN CONVERT(DECIMAL(9, 2), firstyield)
ELSE 0
END) ,
[一月产值] = SUM(CASE WHEN infotype = 2
AND ISNUMERIC(firstyield) = 1
THEN CONVERT(DECIMAL(9, 2), firstyield)
ELSE 0
END) ,
[一月税金] = SUM(CASE WHEN infotype = 3
AND ISNUMERIC(firstyield) = 1
THEN CONVERT(DECIMAL(9, 2), firstyield)
ELSE 0