【正文】
9。街道39。, 39。房屋類型39。, 39。標(biāo)題39。, 39。價(jià)格39。, 39。房源描述39。, 39。時(shí)間39。, 39。備注39。 FROM hos_house hh,hos_street hs,hos_district hd,sys_user su,hos_type ht WHERE = AND = AND = AND = AND =39。張三39。(3) 按區(qū)縣制作房屋出租清單SELECT 39。戶型39。, 39。姓名39。, 39。區(qū)縣39。, 39。街道39。FROM hos_house hh INNER JOIN hos_street hs ON =INNER JOIN hos_district hd ON =INNER JOIN sys_user su ON =INNER JOIN hos_type ht ON = WHERE IN(SELECT FROM hos_house hh INNER JOIN hos_street hs ON = INNER JOIN hos_district hd ON = GROUP BY HAVING COUNT(*)1) ORDER BY 實(shí)訓(xùn)四:業(yè)務(wù)統(tǒng)計(jì)(1) 按季度統(tǒng)計(jì)本年度發(fā)布的房屋出租數(shù)量CREATE VIEW View_QTDst AS SELECT DATEPART(QUARTER,) 39。季度39。, 39。區(qū)縣39。, 39。街道39。, 39。戶型39。,COUNT() 39。數(shù)量39。 FROM hos_house hh INNER JOIN hos_street hs ON =INNER JOIN hos_district hd ON =INNER JOIN sys_user su ON =INNER JOIN hos_type ht ON = GROUP BY DATEPART(QUARTER,),(2) 統(tǒng)計(jì)出各個(gè)季度各個(gè)區(qū)縣出租房屋的數(shù)量SELECT 季度,區(qū)縣,SUM(數(shù)量) 房屋數(shù)量 FROM View_QTDstGROUP BY 季度,區(qū)縣(3) 統(tǒng)計(jì)出各個(gè)季度各個(gè)區(qū)縣出租房屋的數(shù)量總和及街道戶型明細(xì)SELECT 季度,區(qū)縣,街道,戶型,SUM(數(shù)量) 房屋數(shù)量 FROM View_QTDstGROUP BY 季度,區(qū)縣,街道,戶型 UNIONSELECT 季度,區(qū)縣,39。小計(jì)39。,39。39。,SUM(數(shù)量) 房屋數(shù)量 FROM View_QTDstGROUP BY 季度,區(qū)縣UNIONSELECT 季度,39。合計(jì)39。,39。39。,39。39。,SUM(數(shù)量) 房屋數(shù)量 FROM View_QTDstGROUP BY 季度心得體會(huì), .12