时间:2021-07-01 10:21:17 帮助过:13人阅读
其也经常用到判断的关联条件中,其示例如下:
SELECT s.SCHOOL_CITY as schoolCity, s.SCHOOL_COUNTY as schoolCounty, count(DISTINCT `s`.`SCHOOL_ID`) as schoolNum, sum(m.duration) as sumDuration, sum(`m`.`VIEWERCOUNT`) as viewLiveSum, sum(m.replayViewerCount)as reViewSum, sum(m.praisecount) as sumpraise, sum(`m`.`VIEWERCOUNT`+m.replayViewerCount) as viewSum from ((tbl_hbb_mobile_live_statistics m join tbl_hbb_resource_visit_map v) join tbl_school_info s) where`m`.`RESOURCEID`= `v`.`RESOURCEID` and if((`v`.`rangeTYPE`= ‘2‘),(`v`.`rangeID`= `s`.`SCHOOL_ID`),(`v`.`parentId`= `s`.`SCHOOL_ID`))
mysql中if()函数使用
标签:用处 sum student viewer stat sch play ati name