【问题标题】:What is the error in this query此查询中的错误是什么
【发布时间】:2023-04-09 21:22:02
【问题描述】:
  • 数据库:网球
  • 表:匹配
  • 列:matchno(pk)、赢、输...等

问题: 获取每场比赛的比赛编号和输赢盘数,其中赢盘数 >= 输盘数乘以 2。

查询错误:

use tennis;
select matchno, lost * 2 AS spl
from matches 
where won >= spl

这个查询有什么问题?如何修改它以获得正确的输出?

正确查询:

select matchno, won, lost
from matches
where won >= lost * 2

【问题讨论】:

    标签: mysql mysql-error-1054


    【解决方案1】:
    SELECT matchno, lost * 2 AS spl
    FROM matches
    WHERE won >= (lost * 2)
    

    【讨论】:

      猜你喜欢
      • 2020-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-15
      • 2014-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多