W
wzquan
Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT qk, sspjdy = (CASE WHEN SUM(shsr) > SUM(yycb) <br> THEN '效益一类' WHEN SUM(shsr) >= SUM(sccb) AND SUM(shsr) < SUM(yycb) <br> THEN '效益二类' WHEN SUM(shsr) >= SUM(czcb) AND SUM(shsr) < SUM(sccb) <br> THEN '效益三类' WHEN SUM(shsr) < SUM(czcb) THEN '无效益' ELSE '不确定' END), <br> SUM(zjclf) AS A1, SUM(zjrlf) AS A2<br>FROM ydtable a<br>WHERE ny = '200712'<br>GROUP BY qk WITH rollup<br>HAVING (CASE WHEN SUM(shsr) > SUM(yycb) THEN '效益一类' WHEN SUM(shsr) <br> >= SUM(sccb) AND SUM(shsr) < SUM(yycb) THEN '效益二类' WHEN SUM(shsr) <br> >= SUM(czcb) AND SUM(shsr) < SUM(sccb) THEN '效益三类' WHEN SUM(shsr) <br> < SUM(czcb) THEN '无效益' ELSE '不确定' END) = '效益一类'