SELECT
a.id id,
a.gmt_create gmtCreate,
a.gmt_modified gmtModified,
a.app_id appId,
a.app_name appName,
a.dept_no deptNo,
a.dept_name deptName,
a.aone_product_id aoneProductId,
a.aone_product_name aoneProductName,
a.app_score appScore,
a.line_count lineCount,
a.complexity complexity,
a.duplication duplication,
a.comment_rate commentRate,
a.ut_rate utRate,
a.ui_rate uiRate,
a.it_rate itRate,
a.static_code_check_value1 staticCodeCheckValue1,
a.static_code_check_value2 staticCodeCheckValue2,
a.static_code_check_value3 staticCodeCheckValue3,
a.date_stamp dateStamp,
a.deviation deviation,
b.app_score appScoreRelative,
b.complexity complexityRelative,
b.duplication duplicationRelative,
b.comment_rate commentRateRelative,
b.ut_rate utRateRelative,
b.ui_rate uiRateRelative,
b.it_rate itRateRelative,
b.static_code_check_value1 staticCodeCheckValue1Relative,
b.static_code_check_value2 staticCodeCheckValue2Relative,
b.static_code_check_value3 staticCodeCheckValue3Relative
FROM quality_data_of_app a
join quality_data_of_app b
on a.app_id = b.app_id
where a.date_stamp =
(SELECT date(date_stamp) FROM quality_data_of_app
group by date(date_stamp)
order by date(date_stamp) desc limit 1) and
b.date_stamp =
(SELECT date_add(date(date_stamp), interval -30 day) FROM quality_data_of_app
group by date(date_stamp)
order by date(date_stamp) desc limit 1) and
a.dept_name like concat( #{deptName}, '%') and
a.aone_product_id = #{aoneProductId};
MYSQL 一张表的自关联查询
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 开发中遇到这样的一个需求:用户表为A,小区表为B,用户小区关系通过C表多对多关联,我们需要查询出每一个用户所拥有的...
- mysql 多表关联查询 实现 全文匹配的 模糊搜索接口 SQL mysql中FIND_IN_SET的使用方法 ...