我有一个大型数据表,它是由队长将数据输入到电子表格中创建的,它基本上是我们当地羽毛球联赛的记分表。表示每个匹配项,并且该匹配项的所有数据都包含在该行中。例如日期、分区、主队、客队、球员、合作伙伴、得分等。
我试图从我的数据中得到的是最成功的合作伙伴关系。我已经开始使用以下方法识别所有不同的合作伙伴关系:
(SELECT "home mens 1" AS "mens" FROM "Results") UNION
(SELECT "home mens 2" AS "mens" FROM "Results") UNION
(SELECT "home mens 3" AS "mens" FROM "Results") UNION
(SELECT "away mens 1" AS "mens" FROM "Results") UNION
(SELECT "away mens 2" AS "mens" FROM "Results") UNION
(SELECT "away mens 3" AS "mens" FROM "Results") ORDER BY "mens"
这给了我一个很好的配对清单。您可以在此处查看数据表,列标题:https ://docs.google.com/spreadsheet/pub?key=0AkFtD3i39wUZdFJSbVVXUUVvNi0wSXNmNEJ5XzhCWEE&output=html
如果不可能,或者如果我应该以某种方式重组数据,那么我很想听听替代解决方案。
我试过了:
(SELECT "home mens 1" AS "mens", SUM("home score game 1" + "home score game 2") AS "points total" FROM "Results") UNION
(SELECT "home mens 2" AS "mens", SUM("home score game 5" + "home score game 6") AS "points total" FROM "Results") UNION
(SELECT "home mens 3" AS "mens", SUM("home score game 9" + "home score game 10") AS "points total" FROM "Results") UNION
(SELECT "away mens 1" AS "mens", SUM("away score game 1" + "away score game 2") AS "points total" FROM "Results") UNION
(SELECT "away mens 2" AS "mens", SUM("away score game 5" + "away score game 6") AS "points total" FROM "Results") UNION
(SELECT "away mens 3" AS "mens", SUM("away score game 9" + "away score game 10") AS "points total" FROM "Results") ORDER BY "mens"`
但似乎根本不起作用..
在伙伴关系与游戏分数的关系方面:与配对相关的分数列如下:
- 男子对 1 玩游戏 1 和 2
- 女士对 1 玩游戏 3 和 4
- 男双 2 玩游戏 5 和 6
- 女士对 2 玩游戏 7 和 8
- 男子双人 3 玩游戏 9 和 10
- 女士对 3 玩游戏 11 和 12
- 混合对 1 玩游戏 13 和 14
- 混合双人玩游戏 15 和 16
- 混合对 3 玩游戏 17 和 18。
最成功的一对将是赢得最多比赛(得分为 15)的一对,然后是每场比赛平均得分最高的一对。
我在 OpenOffice Base 中执行此操作,虽然就 SQL 而言,我不确定这是基于什么 - 显然这意味着它正在使用 HSQL:http ://www.oooforum.org/forum/viewtopic.phtml?t=140063