我有两个表,我试图从我的Schedule表结果中获取My pool standings表的更新语句。所以我不必手动操作,锦标赛通常有60个手杖和 我基于这两个表的Tourn_ID和TeamID。在Schedule Table TeamID中= Team_A_ID或Team_B_ID,具体取决于Team是否被指定为Team_A或Team_B 如果GMFinal =是,我想更新该TOURN_ID和TeamID的池积分 总计是游泳池常备表将计算(#of Wins * 3 + #of Losss * 0 +#of Ties +1)=总积分任何帮助或建议都将被大大监控。
以下是我的表格结构
SCOREBOARD_TOURNAMENTSS
CREATE TABLE IF NOT NOT EXISTS SCOREBOARD_TOURNAMENTSS
(
ID
int(11)NOT NULL auto_increment,
TOURN_ID
varchar(255)NOT NULL,
TEAM_A_ID
varchar(255)NOT NULL,
TEAM_A
varchar(255)NOT NULL,
TEAM_A_SCORE
int(11)NOT NULL默认为'0',
TEAM_B_ID
varchar(255)NOT NULL,
TEAM_B
varchar(255)NOT NULL,
TEAM_B_SCORE
int(11)NOT NULL默认为'0',
GAMETYPE
varchar(255)NOT NULL,
POOL
varchar(255)NOT NULL,
MF
varchar(11)NOT NULL,
GYMNAME
varchar(255)NOT NULL,
TIME
varchar(255)NOT NULL,
DATE
varchar(255)NOT NULL,
DAY
varchar(255)NOT NULL,
Updated
时间戳NOT NULL在更新CURRENT_TIMESTAMP时默认为CURRENT_TIMESTAMP,
GMFinal
varchar(3)NOT NULL默认为'YES',
VideoURL
varchar(100)默认' - ',
主要关键(ID
)
)ENGINE = MyISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT = 1260;
SCOREBOARD_POOL_STANDINGS
CREATE TABLE IF NOT NOT EXISTS SCOREBOARD_POOL_STANDINGS
(
ID
int(11)NOT NULL auto_increment,
TOURN_ID
varchar(255)NOT NULL默认'MI2009',
TEAM_ID
varchar(255)NOT NULL,
TEAMS
varchar(255)NOT NULL,
MF
varchar(255)NOT NULL,
POOL
varchar(255)NOT NULL,
TOTAL
int(11)NOT NULL,
WON
int(11)NOT NULL,
LOST
int(11)NOT NULL,
TIED
int(11)NOT NULL,
FOR
int(11)NOT NULL,
AGAINST
int(11)NOT NULL,
GD
int(11)NOT NULL,
PLAYOFFSEED
varchar(255)NOT NULL,
主要关键(ID
)
)ENGINE = MyISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT = 384;