SELECT a.estate_name AS estateName, a.location AS estateLocation, IFNULL( b.挂牌数量, 0 ) AS numberListed, IFNULL( c.成交数量, 0 ) AS tradingVolume FROM ( SELECT CONCAT( IFNULL( estate_name, '' ), IFNULL( area_name, '' ) ) AS ea, estate_name, MAX( location ) AS location FROM beike_estate GROUPBY estate_name, area_name ) AS a LEFTJOIN ( SELECT estate_name, COUNT( estate_name ) AS 挂牌数量 FROM beike_property WHERE estate_name ISNOTNULLGROUPBY estate_name ) AS b ON a.estate_name = b.estate_name LEFTJOIN ( SELECT CONCAT( IFNULL( estate_name, '' ), IFNULL( area_name, '' ) ) AS ea, COUNT( estate_name ) AS 成交数量 FROM crawler_publish_property WHERE `status` =1 GROUPBY estate_name, area_name ) AS c ON a.ea = c.ea
SELECT a.estate_name AS estateName, a.location AS estateLocation, ISNULL( b.挂牌数量, 0 ) AS numberListed, ISNULL( c.成交数量, 0 ) AS tradingVolume FROM ( SELECT ISNULL( estate_name, '' ) + ISNULL( area_name, '' ) AS ea, estate_name, MAX ( location ) AS location FROM beike_estate GROUPBY estate_name, area_name ) AS a LEFTJOIN ( SELECT estate_name, COUNT ( estate_name ) AS 挂牌数量 FROM beike_property WHERE estate_name ISNOTNULLGROUPBY estate_name ) AS b ON a.estate_name = b.estate_name LEFTJOIN ( SELECT ISNULL( estate_name, '' ) + ISNULL( area_name, '' ) AS ea, COUNT ( estate_name ) AS 成交数量 FROM crawler_publish_property WHERE [status] =1 GROUPBY estate_name, area_name ) AS c ON a.ea = c.ea