SELECT a.hsid, a.house_code, a.sale_date, a.pjid, COUNT( sdid ) AS num, b.hsid, b.pscid, b.hscode, b.hsarea1, b.hsrealarea1, b.hsusage, b.hsprice, b.hsstatus,sum(CASE WHEN b.hsrealarea1 >0THEN b.hsrealarea1ELSE b.hsarea1END) as c , c.xzarea, c.lpmc,…