|
楼主 |
发表于 2021-9-20 16:44:58
|
显示全部楼层
- SELECT t1.*, t2.result
- , CONCAT(t3.`MainTeam`, '(', t2.sletball, ')(', t2.letball, ')', t3.`GuestTeam`) AS "对阵"
- , CONCAT(t3.`MainTeamGoal`, ':', t3.`GuestTeamGoal`) AS '比分'
- , t2.preresult
- FROM (
- SELECT DATE_FORMAT(DATE_SUB(r.`MatchDate`, INTERVAL 12 HOUR), '%Y-%m-%d') AS mdate
- , MAX(ABS(Undefined4)) AS maxVal
- FROM t_analy_result r, (
- SELECT DATE_FORMAT(DATE_SUB(r.`MatchDate`, INTERVAL 12 HOUR), '%Y-%m-%d') AS mdate
- , MAX(ABS(Undefined4)) AS maxVal
- FROM t_analy_result r
- WHERE r.`AlFlag` = "GE0"
- AND r.`PreResult` = 0
- GROUP BY DATE_FORMAT(DATE_SUB(r.`MatchDate`, INTERVAL 12 HOUR), '%Y-%m-%d')
- ) r1
- WHERE DATE_FORMAT(DATE_SUB(r.`MatchDate`, INTERVAL 12 HOUR), '%Y-%m-%d') = r1.mdate
- AND ABS(r.`Undefined4`) != r1.maxval
- AND r.`AlFlag` = "GE0"
- AND r.`PreResult` = 0
- GROUP BY DATE_FORMAT(DATE_SUB(r.`MatchDate`, INTERVAL 12 HOUR), '%Y-%m-%d')
- ) t1, (
- SELECT DATE_FORMAT(DATE_SUB(r.`MatchDate`,INTERVAL 12 HOUR), '%Y-%m-%d') AS mdate, ABS(Undefined4) AS val
- , r.*
- FROM t_analy_result r
- WHERE r.`AlFlag` = "GE0"
- AND r.`PreResult` = 0
- ) t2, t_match_his t3
- WHERE t1.mdate = t2.mdate
- AND t1.maxval = t2.val
- AND t2.matchId = t3.id
- ORDER BY t1.mdate DESC
复制代码
备份
|
|