提交 984bf123 编写于 作者: S shi.zeyuan

1.bug fix

上级 78d45f23
{{.MainTeam}}
积{{.BFSMainZong.Score}}分,
居排行榜{{.BFSMainZong.Ranking}}名.
{{.GuestTeam}}
积{{.BFSGuestZong.Score}}分,
居排行榜{{.BFSGuestZong.Ranking}}名.
个人心得,结合基本面,亚欧盘.
{{if eq .AlFlag "C1"}}
推算出自认为本次比赛合理的让球应为:{{.MyLetBall}}.
{{end}}
\ No newline at end of file
{{.MainTeam}}近{{.BFSMainJin.MatchCount}}场,取得{{.BFSMainJin.WinCount}}胜,{{.BFSMainJin.DrawCount}}平,{{.BFSMainJin.FailCount}}负.
{{.GuestTeam}}近{{.BFSGuestJin.MatchCount}}场,取得{{.BFSGuestJin.WinCount}}胜,{{.BFSGuestJin.DrawCount}}平,{{.BFSGuestJin.FailCount}}负.
{{if eq .MainTeam .MainNextMainTeam }}
下场赛事,主队继续坐阵主场,具备有一定的心理优势.
{{else}}
下场赛事,主队转圜客场,本场不容有失.
{{end}}
{{if eq .GuestTeam .GuestNextMainTeam }}
下场赛事,客队转回主场作战.
{{else}}
下场赛事,客队继续转圜其他客场,不免受行程疲惫影响.
{{end}}
\ No newline at end of file
近期两队对战{{.BattleCount}}场,
主队{{.BattleMainWinCount}}胜,{{.BattleDrawCount}}平.{{.BattleGuestWinCount}}负.
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "003.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "003.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "004.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "003.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "004.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "002.html" . }}
{{ template "003.html" . }}
{{ template "004.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ $PreResultMain := eq .PreResult 3}}
{{ $BattleMain := gt .BattleMainWinCount .BattleGuestWinCount}}
{{if $PreResultMain}}
{{if $BattleMain}}
本场个人看好主队继续打出.
{{else}}
结合赔率变化,本场个人认为主队打出.
{{end}}
{{else}}
{{if $BattleMain}}
结合赔率变化,本场个人认为客队至少不败.
{{else}}
本场个人认为客队至少不败.
{{end}}
{{end}}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
{{ template "001.html" . }}
{{ template "002.html" . }}
{{ template "005.html" . }}
{{ template "footer.html" . }}
#导出数据
mysqldump -uroot -proot --database foot_this > /backup/foot_this.sql
#导入数据
mysqldump -uroot -pMyNewPass4! < /backup/foot_this.sql
#数据控制语言
\ No newline at end of file
数据定义语言
\ No newline at end of file
数据操纵语言
\ No newline at end of file
SELECT CONCAT('ALTER TABLE ',i.TABLE_NAME,' CHANGE ',i.COLUMN_NAME,' ',i.COLUMN_NAME,' ',i.COLUMN_TYPE,' COMMENT "',i.COLUMN_COMMENT,'";')
FROM INFORMATION_SCHEMA.COLUMNS i
WHERE TABLE_SCHEMA = 'foot' ;
\ No newline at end of file
WHERE TABLE_SCHEMA = 'foot_001' ;
\ No newline at end of file
SELECT CONCAT('ALTER TABLE ',i.TABLE_NAME,' ENGINE=MyISAM',' ;')
FROM INFORMATION_SCHEMA.TABLES i
WHERE TABLE_SCHEMA = 'foot' ;
\ No newline at end of file
WHERE TABLE_SCHEMA = 'foot_001' ;
\ No newline at end of file
SELECT CONCAT('ALTER TABLE ',i.TABLE_NAME,' DROP INDEX ',i.INDEX_NAME,' ;')
FROM INFORMATION_SCHEMA.STATISTICS i
#过滤主键索引
WHERE TABLE_SCHEMA = 'foot' AND i.INDEX_NAME <> 'PRIMARY';
WHERE TABLE_SCHEMA = 'foot_001' AND i.INDEX_NAME <> 'PRIMARY';
SELECT table_schema, table_name,table_rows,CONCAT(TRUNCATE(data_length/1024/1024,2),' MB') AS data_size
FROM information_schema.tables
WHERE table_schema='foot_001' ORDER BY table_rows DESC,table_name ;
\ No newline at end of file
SELECT
l.`Name`,
h.`Id` AS "比赛Id",
h.`MatchDate` AS "比赛时间",
h.`MainTeam` AS "主队",
h.`GuestTeam` AS "客队",
h.`MainTeamGoal` AS "主队全场得分",
h.`GuestTeamGoal` AS "客队全场得分",
h.`MainTeamHalfGoal` AS "主队半场得分",
h.`GuestTeamHalfGoal` AS "客队半场得分",
ca.`Name` AS "菠菜公司",
track.`Sp3`,
track.`SPanKou`,
track.`Sp0`,
track.`Num` AS "变赔顺序",
track.`OddDate` AS "赔率时间"
FROM
t_league l,
t_match_his h,
(SELECT
t1.*
FROM
t_asia_track_202005 t1
UNION
ALL
SELECT
t2.*
FROM
t_asia_track_202006 t2
UNION
ALL
SELECT
t3.*
FROM
t_asia_track_202007 t3) track,
t_comp_asia ca
WHERE 1 = 1
AND h.`LeagueId` = l.`Id`
AND h.`Id` = track.`MatchId`
AND track.`CompId` = ca.`Id`
ORDER BY h.`Id`,
track.compId,
track.num
\ No newline at end of file
SELECT
l.`Name`,
h.`Id` AS "比赛Id",
h.`MatchDate` AS "比赛时间",
h.`MainTeam` AS "主队",
h.`GuestTeam` AS "客队",
h.`MainTeamGoal` AS "主队全场得分",
h.`GuestTeamGoal` AS "客队全场得分",
h.`MainTeamHalfGoal` AS "主队半场得分",
h.`GuestTeamHalfGoal` AS "客队半场得分",
ca.`Name` AS "菠菜公司",
track.`Sp3`,
track.`Sp1`,
track.`Sp0`,
track.`Kelly3` AS "凯利3",
track.`Kelly1` AS "凯利1",
track.`Kelly0` AS "凯利0",
track.`Num` AS "变赔顺序",
track.`OddDate` AS "赔率时间"
FROM
t_league l,
t_match_his h,
(SELECT
t1.*
FROM
t_euro_track_202005 t1
UNION
ALL
SELECT
t2.*
FROM
t_euro_track_202005 t2
UNION
ALL
SELECT
t3.*
FROM
t_euro_track_202005 t3) track,
t_comp ca
WHERE 1 = 1
AND h.`LeagueId` = l.`Id`
AND h.`Id` = track.`MatchId`
AND track.`CompId` = ca.`Id`
ORDER BY h.`Id`,
track.compId,
track.num
\ No newline at end of file
SELECT
l.`Name`,
h.`Id` AS "比赛Id",
h.`MatchDate` AS "比赛时间",
h.`MainTeam` AS "主队",
h.`GuestTeam` AS "客队",
h.`MainTeamGoal` AS "主队全场得分",
h.`GuestTeamGoal` AS "客队全场得分",
h.`MainTeamHalfGoal` AS "主队半场得分",
h.`GuestTeamHalfGoal` AS "客队半场得分",
ca.`Name` AS "菠菜公司",
track.`Sp3`,
track.`SPanKou`,
track.`Sp0`,
track.`Num` AS "变赔顺序",
track.`OddDate` AS "赔率时间"
FROM
t_league l,
t_match_his h,
(SELECT
t1.*
FROM
t_over_under_track_202005 t1
UNION
ALL
SELECT
t2.*
FROM
t_over_under_track_202006 t2
UNION
ALL
SELECT
t3.*
FROM
t_over_under_track_202007 t3) track,
t_comp_asia ca
WHERE 1 = 1
AND h.`LeagueId` = l.`Id`
AND h.`Id` = track.`MatchId`
AND track.`CompId` = ca.`Id`
ORDER BY h.`Id`,
track.compId,
track.num
\ No newline at end of file
DELIMITER $$
USE `foot_001`$$
DROP FUNCTION IF EXISTS `func_query_same_sp310`$$
CREATE DEFINER=`root`@`%` FUNCTION `func_query_same_sp310`(
matchDate DATETIME,
compId INT,
sp3 DOUBLE,
sp1 DOUBLE,
sp0 DOUBLE
) RETURNS INT
BEGIN
DECLARE pick INT ;
DECLARE done INT DEFAULT 0;
DECLARE mw,mwc INT DEFAULT 0;
DECLARE ml,mlc INT DEFAULT 0;
-- 声明游标
DECLARE mc CURSOR FOR SELECT
IF(
mh.MainTeamGoal > mh.GuestTeamGoal,
1,
0
) AS mainWin,
IF(
mh.MainTeamGoal < mh.GuestTeamGoal,
1,
0
) AS mainLoss
FROM
t_match_his mh,
t_euro_his_2020 eh
WHERE 1 = 1
AND mh.Id = eh.MatchId
AND eh.CompId = compId
AND eh.Sp3 = sp3
AND eh.Sp1 = sp1
AND eh.Sp0 = sp0
AND eh.MatchDate < matchDate ;
-- 指定游标循环结束时的返回值
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=10000;
OPEN mc;
xxx:LOOP
-- 根据游标当前指向的一条数据
FETCH mc INTO mw,ml;
-- 当 游标的返回值为 1 时 退出 loop循环
IF done = 10000 THEN
LEAVE xxx;
END IF;
IF mw > 0 THEN
SET mwc = mwc+1;
END IF;
IF ml > 0 THEN
SET mlc = mlc+1;
END IF;
END LOOP;
CLOSE mc;
SET pick = mwc * 10000 + mlc;
RETURN pick ;
END$$
DELIMITER ;
\ No newline at end of file
SELECT
*
FROM
(SELECT
(t.s1idx + t.s2idx + t.s3idx) sidx,
FLOOR((t.s1idx + t.s2idx + t.s3idx) / 10000) sidx_3,
FLOOR((t.s1idx + t.s2idx + t.s3idx) % 10000) sidx_0,
IF(
FLOOR((t.s1idx + t.s2idx + t.s3idx) / 10000) > FLOOR((t.s1idx + t.s2idx + t.s3idx) % 10000),
"6666666666",
"败败败败败"
) sidx_result,
(t.e1idx + t.e2idx + t.e3idx) eidx,
FLOOR((t.e1idx + t.e2idx + t.e3idx) / 10000) eidx_3,
FLOOR((t.e1idx + t.e2idx + t.e3idx) % 10000) eidx_0,
IF(
FLOOR((t.e1idx + t.e2idx + t.e3idx) / 10000) > FLOOR((t.e1idx + t.e2idx + t.e3idx) % 10000),
"6666666666",
"败败败败败"
) eidx_result,
t.*
FROM
(SELECT
IF(
mh.MainTeamGoal > mh.GuestTeamGoal,
"6666666666",
"败败败败败"
) AS mainResult,
mh.id,
mh.`MatchDate`,
mh.`MainTeam`,
CONCAT(
"(",
ah.spankou,
")",
"(",
ah.epankou,
")"
) AS "(初)(即时)",
CONCAT(
mh.`MainTeamGoal`,
":",
mh.`GuestTeamGoal`,
"(",
mh.`MainTeamHalfGoal`,
":",
mh.`GuestTeamHalfGoal`,
")"
) AS score,
mh.`GuestTeam`,
#bc1.compId,
bc1.compName AS compName1,
func_query_same_sp310 (
mh.`MatchDate`,
"281",
bc1.sp3,
bc1.sp1,
bc1.sp0
) AS s1idx,
#bc1.spayout,
func_query_same_ep310 (
mh.`MatchDate`,
"281",
bc1.ep3,
bc1.ep1,
bc1.ep0
) AS e1idx,
#bc1.epayout,
#bc2.compId,
bc2.compName AS compName2,
func_query_same_ep310 (
mh.`MatchDate`,
"115",
bc2.sp3,
bc2.sp1,
bc2.sp0
) AS s2idx,
#bc2.spayout,
func_query_same_ep310 (
mh.`MatchDate`,
"115",
bc2.ep3,
bc2.ep1,
bc2.ep0
) AS e2idx,
#bc2.epayout,
#bc3.compId,
bc3.compName AS compName3,
func_query_same_ep310 (
mh.`MatchDate`,
"16",
bc3.sp3,
bc3.sp1,
bc3.sp0
) AS s3idx,
#bc3.spayout,
func_query_same_ep310 (
mh.`MatchDate`,
"16",
bc3.ep3,
bc3.ep1,
bc3.ep0
) AS e3idx #bc3.epayout
FROM
t_match_his mh,
(SELECT
ah.*
FROM
t_asia_his_2020 ah
WHERE ah.compid = "8") ah,
(SELECT
eh.*
FROM
t_euro_his_2020 eh
WHERE eh.compid = "281") bc1,
(SELECT
eh.*
FROM
t_euro_his_2020 eh
WHERE eh.compid = "115") bc2,
(SELECT
eh.*
FROM
t_euro_his_2020 eh
WHERE eh.compid = "16") bc3
WHERE 1 = 1
AND mh.id = ah.matchId
AND mh.id = bc1.matchId
AND mh.id = bc2.matchId
AND mh.id = bc3.matchId) t) t
WHERE 1 = 1
AND ABS(t.sidx_3 - t.sidx_0) >= 3
AND ABS(t.eidx_3 - t.eidx_0) >= 3
LIMIT 0, 50
\ No newline at end of file
#用于查询稳定的场次
SELECT
ar.MatchDate,
ar.AlFlag,
ar.PreResult,
ar.Result,
ar.HitCount,
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
ar1.Id
FROM
t_analy_result ar1
WHERE ar1.MatchId IN
(SELECT
temp.matchId
FROM
t_analy_result temp
GROUP BY temp.MatchId
HAVING COUNT(1) >= 3)) temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.Id = temp.id
ORDER BY ar.MatchDate DESC,
l.id ASC,
mh.MainTeamId ASC,
ar.AlFlag DESC
\ No newline at end of file
SELECT
ar.MatchDate,
ar.AlFlag,
ar.PreResult,
ar.Result,
ar.HitCount,
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
ar1.MatchId
FROM
t_analy_result ar1,
t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'Q1'
AND ar2.AlFlag = 'A1'
) temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.MatchId = temp.MatchId
ORDER BY ar.MatchDate DESC,
l.id ASC,
mh.MainTeamId ASC,
ar.AlFlag DESC ,
ar.PreResult DESC
\ No newline at end of file
SELECT
ar.MatchDate,
ar.TOVoid,
ar.TOVoidDesc,
ar.AlFlag,
ar.PreResult,
ar.Result,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal,
ar.HitCount,
ar.LetBall,
ar.MyLetBall,
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
temp.MatchId
FROM
(SELECT
ar1.MatchId,
ar1.PreResult
FROM
t_analy_result ar1,
t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'E2'
AND ar2.AlFlag = 'C1'
AND ar1.PreResult = ar2.PreResult
AND ar2.TOVoidDesc = '') temp,
t_analy_result a1
WHERE a1.MatchId = temp.MatchId
AND a1.AlFlag = 'A1'
AND a1.PreResult = temp.PreResult) temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.MatchId = temp.MatchId
AND ar.AlFlag IN ('E2', 'C1','A1')
ORDER BY ar.MatchDate DESC,
l.id ASC,
mh.MainTeamId ASC,
ar.AlFlag DESC,
ar.PreResult DESC
\ No newline at end of file
SELECT ar.MatchDate,
ar.TOVoid,
ar.TOVoidDesc,
ar.AlFlag,
ar.PreResult,
ar.Result,
ar.HitCount,
ar.LetBall,
ar.MyLetBall,
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
ar1.MatchId
FROM
t_analy_result ar1,
t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'E2'
AND ar2.AlFlag = 'C1'
AND ar1.PreResult = ar2.PreResult
) temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.MatchId = temp.MatchId
AND ar.AlFlag IN ('E2' ,'C1')
ORDER BY ar.MatchDate DESC,
l.id ASC,
mh.MainTeamId ASC,
ar.AlFlag DESC ,
ar.PreResult DESC
\ No newline at end of file
SELECT
ar.MatchDate,
ar.TOVoid,
ar.TOVoidDesc,
ar.AlFlag,
ar.PreResult,
ar.Result,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal,
ar.HitCount,
ar.LetBall,
ar.MyLetBall,
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
ar1.MatchId
FROM
t_analy_result ar1,
t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'E2'
AND ar2.AlFlag = 'C1'
AND ar1.PreResult = ar2.PreResult
AND ar2.TOVoidDesc = '') temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
#AND mh.MainTeamGoal != mh.GuestTeamGoal
AND ar.MatchId = temp.MatchId
AND ar.AlFlag IN ('E2', 'C1')
ORDER BY ar.MatchDate DESC,
l.id ASC,
mh.MainTeamId ASC,
ar.AlFlag DESC,
ar.PreResult DESC
#-------------------------------------
#-------------------------------------
#-------------------------------------
SELECT
COUNT(1) / 2,
ar.Result
FROM
t_league l,
t_match_his mh,
t_analy_result ar,
(SELECT
ar1.MatchId
FROM
t_analy_result ar1,
t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'E2'
AND ar2.AlFlag = 'C1'
AND ar1.PreResult = ar2.PreResult
AND ar2.TOVoidDesc = '') temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
#AND mh.MainTeamGoal != mh.GuestTeamGoal
AND ar.MatchId = temp.MatchId
AND ar.AlFlag IN ('E2', 'C1')
GROUP BY ar.Result
\ No newline at end of file
SELECT
COUNT(IF(r.Result = "命中", 1, 0)) AS hitCount,
COUNT(IF(r.Result = "错误", 1, 0)) AS failCount,
DATE_FORMAT(r.MatchDate, '%Y-%m') AS md
FROM
t_analy_result r
WHERE r.AlFlag = 'C1'
GROUP BY md ORDER BY md ASC
\ No newline at end of file
SELECT
*
FROM
(SELECT
ar.AlFlag AS 'flag',
DATE_FORMAT(ar.MatchDate, '%w') AS 'week',
ar.LetBall AS 'letball',
COUNT(1) AS 'total',
SUM(IF (ar.Result = "命中", 1, 0)) AS 'right',
SUM(IF (ar.Result = "错误", 1, 0)) AS 'error',
SUM(IF (ar.Result = "走盘", 1, 0)) AS 'none',
SUM(
IF (
mh.MainTeamGoal > mh.GuestTeamGoal,
1,
0
)
) AS '3',
SUM(
IF (
mh.MainTeamGoal = mh.GuestTeamGoal,
1,
0
)
) AS '1',
SUM(
IF (
mh.MainTeamGoal < mh.GuestTeamGoal,
1,
0
)
) AS '0'
FROM
t_analy_result ar,
t_match_his mh,
t_league l
WHERE ar.MatchId = mh.Id
AND mh.LeagueId = l.Id
AND ar.TOVoidDesc = ''
AND ar.Result != "待定"
AND ar.AlFlag IN ('C1', 'C2') #AND DATE_FORMAT(ar.MatchDate, '%w') = 0
GROUP BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall
ORDER BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall) t
WHERE 1 = 1 # and t.total > 10
# AND (
# t.error / t.total >= 0.8
# OR t.right / t.total >= 0.8
# OR t.none / t.total >= 0.8
# OR t .1 / t.total > 0.5
# )
ORDER BY t.week ASC
\ No newline at end of file
SELECT
*
FROM
(SELECT
ar.AlFlag AS 'flag',
DATE_FORMAT(ar.MatchDate, '%w') AS 'week',
ar.LetBall AS 'letball',
COUNT(1) AS 'total',
SUM(IF (ar.Result = "命中", 1, 0)) AS 'right',
SUM(IF (ar.Result = "错误", 1, 0)) AS 'error',
SUM(IF (ar.Result = "走盘" OR ar.Result = "未知" OR ar.Result = "", 1, 0)) AS 'none',
SUM(
IF (
mh.MainTeamGoal > mh.GuestTeamGoal,
1,
0
)
) AS '3',
SUM(
IF (
mh.MainTeamGoal = mh.GuestTeamGoal,
1,
0
)
) AS '1',
SUM(
IF (
mh.MainTeamGoal < mh.GuestTeamGoal,
1,
0
)
) AS '0'
FROM
t_analy_result ar,
t_match_his mh,
t_league l
WHERE ar.MatchId = mh.Id
AND mh.LeagueId = l.Id
AND ar.TOVoidDesc = ''
AND ar.Result != "待定"
AND ar.AlFlag IN ('C4') #AND DATE_FORMAT(ar.MatchDate, '%w') = 0
GROUP BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall
ORDER BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall) t
WHERE 1 = 1 # and t.total > 10
# AND (
# t.error / t.total >= 0.8
# OR t.right / t.total >= 0.8
# OR t.none / t.total >= 0.8
# OR t .1 / t.total > 0.5
# )
ORDER BY t.week ASC
\ No newline at end of file
SELECT table_schema, table_name,table_rows
FROM information_schema.tables
WHERE table_schema='foot' ORDER BY table_rows DESC;
\ No newline at end of file
DELIMITER $$
USE `foot_001`$$
DROP PROCEDURE IF EXISTS `proc_check_pankou`$$
CREATE DEFINER=`root`@`%` PROCEDURE `proc_check_pankou`(
IN matchId VARCHAR(20),
IN CompId INT,
OUT pick INT
)
BEGIN
DECLARE upCount INT DEFAULT 0 ;
DECLARE downCount INT DEFAULT 0 ;
DECLARE done INT DEFAULT 0;
DECLARE l_matchid VARCHAR(20);
DECLARE l_spankou,temp_spankou DOUBLE;
DECLARE l_num INT;
DECLARE matchDate DATETIME;
-- 声明游标
DECLARE mc CURSOR FOR (SELECT t.matchId,t.SPanKou,t.Num FROM v_asia_track_temp t WHERE 1=1 );
-- 指定游标循环结束时的返回值
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=10000;
SELECT h.MatchDate INTO matchDate FROM t_match_his h WHERE h.id = matchid LIMIT 0,1;
SET @sqlstr = "CREATE OR REPLACE VIEW v_asia_track_temp as select t.* from t_asia_track_";
SET @sqlstr = CONCAT(@sqlstr , DATE_FORMAT(matchDate,'%Y%m')," t where 1=1 ");
SET @sqlstr = CONCAT(@sqlstr , " AND t.matchid = '",matchId,"'");
SET @sqlstr = CONCAT(@sqlstr , " AND t.OddDate < '",matchDate,"'");
SET @sqlstr = CONCAT(@sqlstr , " AND t.compId = ",compid);
SET @sqlstr = CONCAT(@sqlstr , " ORDER BY t.num DESC ");
PREPARE stmt FROM @sqlstr;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
OPEN mc;
SET temp_spankou = -10000;
xxx:LOOP
-- 根据游标当前指向的一条数据
FETCH mc INTO l_matchid,l_spankou,l_num;
-- 当 游标的返回值为 1 时 退出 loop循环
IF done = 10000 THEN
LEAVE xxx;
END IF;
IF temp_spankou = -10000 THEN
SET temp_spankou = l_spankou;
END IF;
IF l_spankou < temp_spankou THEN
SET temp_spankou = l_spankou;
SET downCount = downCount+1;
END IF;
IF l_spankou > temp_spankou THEN
SET temp_spankou = l_spankou;
SET upCount = upCount+1;
END IF;
END LOOP;
CLOSE mc;
SET pick = upCount * 10000 + downCount ;
SELECT
h.`Id`,
l.`Name`,
h.`MatchDate` AS "比赛时间",
h.`MainTeam` AS "主队",
h.`GuestTeam` AS "客队",
h.`MainTeamGoal` AS "主得分",
h.`GuestTeamGoal` AS "客得分",
h.`MainTeamHalfGoal` AS "主半得分",
h.`GuestTeamHalfGoal` AS "客半得分",
upCount AS "升盘",
downCount AS "降盘",
ah.sp3,
ah.spankou AS "初盘",
ah.sp0,
ah.ep3,
ah.epankou AS "终盘",
ah.ep0
FROM
t_league l,
t_match_his h,
t_asia_his_2020 ah
WHERE 1 = 1
AND h.`LeagueId` = l.`Id`
AND h.id = matchId
AND ah.matchId = matchId
AND ah.compid = compid
;
END$$
DELIMITER ;
\ No newline at end of file
SELECT
*
SELECT t.* FROM (SELECT
t.right / (t.total - t.none) AS '命中率',
t.1 / (t.total) AS '平局率',
t.*
FROM
(SELECT
ar.AlFlag AS 'flag',
DATE_FORMAT(ar.MatchDate, '%w') AS 'week',
ar.LetBall AS 'letball',
ar.AlFlag AS 'flag',
IF(ar.preresult = 3, '主', '客') AS '推荐',
COUNT(1) AS 'total',
SUM(IF (ar.Result = "命中", 1, 0)) AS 'right',
SUM(IF (ar.Result = "错误", 1, 0)) AS 'error',
SUM(IF (ar.Result = "走盘", 1, 0)) AS 'none',
SUM(
IF (
ar.Result = "走盘"
OR ar.Result = "未知"
OR ar.Result = "",
1,
0
)
) AS 'none',
SUM(
IF (
mh.MainTeamGoal > mh.GuestTeamGoal,
......@@ -36,20 +46,14 @@ FROM
t_league l
WHERE ar.MatchId = mh.Id
AND mh.LeagueId = l.Id
AND ar.TOVoidDesc = ''
AND ar.Result != "待定"
AND ar.AlFlag IN ('A1', 'A3') #AND DATE_FORMAT(ar.MatchDate, '%w') = 0
AND ar.AlFlag IN ('E1')
GROUP BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall
ar.preresult
ORDER BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall) t
WHERE 1 = 1 #and t.total > 10
#AND (
# t.error / t.total >= 0.8
# OR t.right / t.total >= 0.8
# OR t.none / t.total >= 0.8
# OR t .1 / t.total > 0.5
#)
ORDER BY t.flag, t.week ASC
\ No newline at end of file
ar.preresult) t
) t WHERE 1 = 1
ORDER BY t.flag,
t.week ASC
\ No newline at end of file
SELECT
*
t.right / (t.total-t.none) AS '命中率',
t.1 / (t.total) AS '平局率',
t.*
FROM
(SELECT
DATE_FORMAT(ar.MatchDate, '%m') AS 'month',
ar.AlFlag AS 'flag',
DATE_FORMAT(ar.MatchDate, '%w') AS 'week',
ar.LetBall AS 'letball',
IF(ar.preresult = 3 , '主','客') AS '推荐' ,
COUNT(1) AS 'total',
SUM(IF (ar.Result = "命中", 1, 0)) AS 'right',
SUM(IF (ar.Result = "错误", 1, 0)) AS 'error',
SUM(IF (ar.Result = "走盘", 1, 0)) AS 'none',
SUM(
IF (
ar.Result = "走盘"
OR ar.Result = "未知"
OR ar.Result = "",
1,
0
)
) AS 'none',
SUM(
IF (
mh.MainTeamGoal > mh.GuestTeamGoal,
......@@ -36,20 +46,10 @@ FROM
t_league l
WHERE ar.MatchId = mh.Id
AND mh.LeagueId = l.Id
AND ar.TOVoidDesc = ''
AND ar.Result != "待定"
AND ar.AlFlag IN ('E1', 'E2') #AND DATE_FORMAT(ar.MatchDate, '%w') = 0
GROUP BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall
DATE_FORMAT(ar.MatchDate, '%m'),ar.preresult
ORDER BY ar.AlFlag,
DATE_FORMAT(ar.MatchDate, '%w'),
ar.LetBall) t
WHERE 1 = 1 #and t.total > 10
#AND (
# t.error / t.total >= 0.8
# OR t.right / t.total >= 0.8
# OR t.none / t.total >= 0.8
# OR t .1 / t.total > 0.5
#)
ORDER BY t.flag, t.week ASC
\ No newline at end of file
DATE_FORMAT(ar.MatchDate, '%m'),ar.preresult) t
WHERE 1 = 1
ORDER BY t.flag,t.month ASC
\ No newline at end of file
DROP table IF EXISTS `temp_tuijian_lt_this`;
CREATE TABLE temp_tuijian_lt_this AS
SELECT
t.*
FROM
(SELECT
l.Id AS LeagueId,
l.Name AS LeagueName,
mh.MainTeam AS MainTeam,
mh.GuestTeam AS GuestTeam,
mh.MainTeamGoal AS MainTeamGoal,
mh.GuestTeamGoal AS GuestTeamGoal,
mh.MainTeamHalfGoal,
mh.GuestTeamHalfGoal,
func_istuijian_lt_this (
mh.`LeagueId`,
ar.`AlFlag`,
ar.`PreResult`,
mh.`MatchDate`
) AS istuijian,
ar.*
FROM
t_league l,
t_match_his mh,
t_analy_result ar
WHERE 1 = 1
AND mh.LeagueId = l.Id
AND mh.Id = ar.MatchId) t
WHERE t.istuijian != 0 ;
CREATE OR REPLACE VIEW v_c4_0_novoid AS
SELECT
l.`Name` AS "联赛",
h.`Id`,
h.`MatchDate`,
CONCAT(
h.`MainTeam`,
"(",
r.`SLetBall`,
")",
"(",
r.`LetBall`,
")",
h.`GuestTeam`
) AS "主(初)(即时)客",
CONCAT(
h.`MainTeamGoal`,
":",
h.`GuestTeamGoal`,
"(",
h.`MainTeamHalfGoal`,
":",
h.`GuestTeamHalfGoal`,
")"
) AS "比分(半场)",
r.`AlFlag`,
r.`Result`,
r.`PreResult`,
r.`TOVoid`
FROM
t_league l,
t_match_his h,
t_analy_result r
WHERE 1 = 1
AND h.`LeagueId` = l.`Id`
AND h.`Id` = r.`MatchId`
AND r.`AlFlag` = "C4"
AND r.`TOVoid` IS FALSE
and r.preResult = 0
ORDER BY r.`MatchDate` DESC,
r.Result,
r.preresult DESC
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册