如果等级=将这支球队放在这里? [英] If rank = this put team here?

查看:56
本文介绍了如果等级=将这支球队放在这里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该怎么做?

如果发生这种情况,请在字段gameswon中添加数字1:

add a number 1 to the field gameswon if this occurs:

伪代码:

table names = 'games', 'teams'
fields =  score1, score2, gameswon

If 'games'.score1 > 'games'.score2
    add 1 to 'teams'.gameswon
else if 'games'.score2 > 'games'.score1
    add 1 to 'teams'.gameswon


也:


Also:

如何从一个表中对在另一个表中具有相同字段的团队进行排名?

how can I rank teams from one table who have the same field in another table?

例如:

它在表'teams'

并且它在表'games'

因此,如果表'games'中的pool1相同,则更新表'teams'中的rank--

so if pool1 is the same in table 'games' then update rank in table 'teams' --

邮政编码:

if gameswon from TEAM1 > gameswon from TEAM2 and > gameswon from TEAM3
    rank TEAM1 with a 1

这可能吗?

推荐答案

第一个问题查询:

INSERT
INTO   teams
       (
          gameswon
       )
SELECT 1 AS gameswon
FROM   games
WHERE  score1 <> score2

我不理解的第二个问题
请提供完整的表格结构

second question I do not understood
please provide full table structure

这篇关于如果等级=将这支球队放在这里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆