日期:2014-05-17 浏览次数:20483 次
SELECT a.组, a.类型, (CASE WHEN a.股份 IS NOT NULL THEN a.股份 ELSE 100-g.股份 END) AS 股份, (CASE WHEN a.面积 IS NOT NULL THEN a.面积 ELSE g.面积 END) AS 面积
FROM TableA a LEFT JOIN
(SELECT 组, 类型, 股份, 面积 FROM TableA WHERE 股份 IS NOT NULL AND 面积 IS NOT NULL) g
ON a.组 = g.组