多表 JOIN 查询统计要记得去重

多表 JOIN 查询统计要记得去重

SELECT p.id projectId,
          ccr.commit_time changeDate,
          sum(ccr.line_count) changeLine,
          now() gmtCreate,
          now() gmtModified
        FROM aone_statistics_code_commit_record ccr
        JOIN (SELECT branch_url, aone_project_id from change_request_branch where aone_project_id is not null  GROUP BY branch_url) crb on ccr.branch_url = crb.branch_url
        JOIN project p on crb.aone_project_id = p.aone_project_id where p.id = 550
        and (ccr.commit_type!= 'merge' or ccr.commit_type is null)
        and ccr.line_count < 3000
        and ccr.author not in ('apsara-scm','scm.cloud','admin.for.aone','myscm','admin.for.aliwing','admin.for.perth','shop_admin','svnadmin','admin.for.linke','search_sp_admin','van.yzt','aecp-code-manager')
GROUP BY date(changeDate);
上一篇:Myisam表的concurrent inserts特性


下一篇:关于百度地图API的地图坐标转换问题